<jupyter_start><jupyter_text>wav2vec-u Common Voice Swedish - prepare tsv> "For use with wav2vec-u"- toc: false- branch: master- badges: false- hidden: true- categories: [kaggle, wav2vec-u] Original [here](https://www.kaggle.com/jimregan/fork-of-wav2vec-u-cv-swedish-tsv)<jupyter_code>import soundfile
input = {
    'train': '/kaggle/input/download-common-voice-swedish/cv-corpus-6.1-2020-12-11/sv-SE/train.tsv',
    'test': '/kaggle/input/download-common-voice-swedish/cv-corpus-6.1-2020-12-11/sv-SE/test.tsv',
    'valid': '/kaggle/input/download-common-voice-swedish/cv-corpus-6.1-2020-12-11/sv-SE/dev.tsv'
}
for split in input.keys():
    with open(input[split], 'r') as tsv:
        with open(f'/kaggle/working/{split}.tsv', 'w') as out:
            print('/kaggle/input/common-voice-swedish-16bit-wav/', file=out)
            for line in tsv.readlines():
                data = line.split('\t')
                if data[1] == 'path':
                    continue
                file = data[1]
                file = file.replace('.mp3', '.wav')
                path = f'/kaggle/input/common-voice-swedish-16bit-wav/{file}'
                frames = soundfile.info(path).frames
                print("{}\t{}".format(file, frames), file=out)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1750392464678179, 'fraction_numerical': 0.03218210361067504, 'mean_word_length': 2.522099447513812, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '409097', 'license': 'Apache-2.0', 'n_tokens_mistral': 496, 'n_tokens_neox': 470, 'n_words': 69, 'path': '_notebooks/2021-05-25-wav2vec-u-cv-swedish-tsv.ipynb', 'repo_name': 'jimregan/notes', 'size': '1274'}