def test_str(): from model.configuration import Configuration config = Configuration() expected_model = 'phone_call' expected_language_code = 'hi-IN' expected_use_enhanced = True expected_sample_rate_hertz = 48000 expected_audio_channel_count = 5 expected_enable_separate_recognition_per_channel = False expected_boost = 6 expected_phrases = ['testing', '$ADDRESSNUM'] config.set_model(expected_model) config.set_language_code(expected_language_code) config.set_enable_separate_recognition_per_channel( expected_enable_separate_recognition_per_channel) config.set_audio_channel_count(expected_audio_channel_count) config.set_use_enhanced(expected_use_enhanced) config.set_sample_rate_hertz(expected_sample_rate_hertz) config.set_speech_context(expected_phrases, expected_boost) result = config.__str__() assert isinstance(result, str) assert expected_model in result assert expected_language_code in result assert str(expected_use_enhanced) in result assert str(expected_sample_rate_hertz) in result assert str(expected_audio_channel_count) in result assert str(expected_enable_separate_recognition_per_channel) in result assert str(expected_boost) in result
print(string) logger.debug(string) if phrases: configuration.set_speech_context(phrases, boost) else: configuration.set_speech_context([], 0) if alt_run: configuration.set_alternative_language_codes(alternative_language_codes) configuration.set_model(model) configuration.set_sample_rate_hertz(sample_rate_hertz) configuration.set_language_code(language) configuration.set_encoding(encoding) if audio_channel_count > 1: configuration.set_audio_channel_count(audio_channel_count) configuration.set_enable_separate_recognition_per_channel(True) logger.debug(f'CONFIGURATION: {configuration}') print(f'STARTING') msg = f'audio: {audio}, {configuration}' logger.debug(msg) print(msg) # Generate hyp speech_to_text = SpeechToText() if use_fake_hyp: hyp = 'this is a fake hyp'
def test_set_audio_channel_count(): from model.configuration import Configuration config = Configuration() config.set_audio_channel_count(1)