Esempio n. 1
0
def test_get_root_filename_from_file_name():
    from utilities.utilities import Utilities
    u = Utilities()
    expected = 'file'
    data = 'file.doc'
    result = u.get_root_filename(data)
    assert result == expected
Esempio n. 2
0
def test_get_root_filename_from_uri():
    from utilities.utilities import Utilities
    u = Utilities()
    expected = 'file'
    data = 'gs://foo/bar/baz/file.wav'
    result = u.get_root_filename(data)
    assert result == expected
        else:
            enhanced_runs = [False]

        for use_enhanced in enhanced_runs:
            configuration.set_use_enhanced(use_enhanced)
            logger.debug(f'ENAHANCED: {use_enhanced}')
            if alternative_language_codes:
                alternative_runs = [True, False]
            else:
                alternative_runs = [False]


            for alt_run in  alternative_runs:
                logger.debug(f'ALT RUN: {alt_run}')
                for audio in audio_list:
                    root = utilities.get_root_filename(audio)

                    #read reference
                    if not only_transcribe:
                        msg = f'READING: Reference file {cloud_store_uri}/{root}.txt'
                        print(msg)
                        logger.debug(msg)

                    if not local_files_path:
                        ref = gcs.read_ref(cloud_store_uri, root + '.txt')
                    else:
                        ref = io_handler.read_file(local_files_path + '/' + root + '.txt')
                    logger.debug(f'INIT REF: {ref}')
                    #for speech_run in speech_context_runs:
                    for boost in boosts:
                        for language in language_codes: