<jupyter_start><jupyter_text>Parse beam file<jupyter_code>beam = parse_beam_file('data/beam_file.txt')
beam<jupyter_output><empty_output><jupyter_text>Write beam file<jupyter_code>from genesis.writers import write_beam_file
fname = 'test_beam.txt'

write_beam_file(fname, beam)

# Parse again
beam2 = parse_beam_file(fname)
beam2
# Check that these are the same
for n in beam:
    assert(all(beam[n] == beam2[n]))
# Cleanup
os.remove(fname)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1127659574468085, 'fraction_numerical': 0.006382978723404255, 'mean_word_length': 8.235294117647058, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '622383', 'license': 'Apache-2.0', 'n_tokens_mistral': 197, 'n_tokens_neox': 183, 'n_words': 33, 'path': 'examples/beam_file_example.ipynb', 'repo_name': 'nneveu/lume-genesis', 'size': '470'}