<jupyter_start><jupyter_text>"Azure ASR's JSONL output to JSON"> "Just getting 1-best"- toc: false- branch: master- comments: true- categories: [azure, irish, asr]<jupyter_code>import glob
import json
for i in glob.glob('../input/mo-sgeal-fein-wikisource-azure-asr-output/*.jsonl'):
    outf = i.replace('jsonl', 'json').split('/')[-1]
    with open(i) as f:
        curfile = []
        for line in f.readlines():
            cur = {}
            json_data = json.loads(line)
            cur['start'] = json_data['Offset']
            cur['duration'] = json_data['Duration']
            cur['text'] = json_data['NBest'][0]['Lexical']
            curfile.append(cur)
        with open(outf, 'w') as of:
            json.dump(curfile, of)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1681877444589309, 'fraction_numerical': 0.003911342894393742, 'mean_word_length': 2.7281553398058254, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '279817', 'license': 'Apache-2.0', 'n_tokens_mistral': 263, 'n_tokens_neox': 259, 'n_words': 55, 'path': '_notebooks/2021-05-04-msf-azure-jsonl-to-json.ipynb', 'repo_name': 'jimregan/notes', 'size': '767'}