コード例 #1
0
def test_set_get_encoding():
    from model.configuration import Configuration
    config = Configuration()
    expected = 'FLAC'
    config.set_encoding(expected)
    result = config.get_encoding()
    assert result == expected
def test_get_hypothesis():
    from model.configuration import Configuration
    from utilities.speech_to_text import SpeechToText
    uri = 'gs://brb/test_audio_n_truth/1.wav'
    configuration_object = Configuration()
    configuration_object.set_language_code('en-US')
    configuration_object.set_encoding('LINEAR16')
    configuration_object.set_sample_rate_hertz(44100)
    configuration_object.set_model('default')
    speech = SpeechToText()
    result = speech.get_hypothesis(uri, configuration_object)
    expected = ' testing 1 2 3  hello hello testing one two three'
    assert result == expected
                            else:
                                string = 'No speech context applied'
                            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()
コード例 #4
0
def test_set_encoding():
    from model.configuration import Configuration
    config = Configuration()
    data = 'MP3'
    config.set_encoding(data)