<jupyter_start><jupyter_text>clean-papers-bibtexThis script cleans a bibtex generated by Papers3. In particular it removes lines that reference to Papers3 or its files.<jupyter_code>BIBTEX_FILE = "/<path-to-file>"
with open(BIBTEX_FILE, "r") as bibtex_in:
    lines = bibtex_in.readlines()

new_lines = [line for line in lines
             if not (line.startswith("uri = {\\url{papers3") or 
                     line.startswith("local-url = ") or 
                     line.startswith("file = "))]

with open(BIBTEX_FILE + '.cleaned', 'w') as bibtex_out:
    bibtex_out.writelines(new_lines)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11736334405144695, 'fraction_numerical': 0.00482315112540193, 'mean_word_length': 3.4184397163120566, 'pattern_counts': {'":': 0, '<': 6, '<?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': '156537', 'license': 'MIT', 'n_tokens_mistral': 226, 'n_tokens_neox': 210, 'n_words': 49, 'path': 'clean-papers-bibtex.ipynb', 'repo_name': 'timtroendle/zotero-scripts', 'size': '622'}