<jupyter_start><jupyter_text>A simple web demo of [Rebiber](https://github.com/yuchenlin/rebiber).We often cite papers using their arXiv versions without noting that they are already PUBLISHED in some conferences. These unofficial bib entries might violate rules about submissions or camera-ready versions for some conferences. We introduce Rebiber, a simple tool in Python to fix them automatically. It is based on the official conference information from the DBLP or the ACL anthology (for NLP confernces)! You can check the list of [supported conferences](https://github.com/yuchenlin/rebibersupported-conferences).  Step 1: Install Rebiber.<jupyter_code>%%capture
# Install rebiber package from git, may need to restart runtime
!pip install rebiber -U
#!pip install -e git+https://github.com/yuchenlin/rebiber.git#egg=rebiber -U<jupyter_output><empty_output><jupyter_text>Step 2: Import Bib.  by Uploading<jupyter_code># Run this cell, then clilck upload to upload file(s)
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
  print('User uploaded file "{name}" with length {length} bytes'.format(
      name=fn, length=len(uploaded[fn])))
ls_bibfiles = list(uploaded.keys())

# print fn and # of bib records in each file
import rebiber
for fn in ls_bibfiles:
  bib_entries = rebiber.load_bib_file(fn)
  print("filename: {}; # of entries: {}".format(fn, len(bib_entries)))<jupyter_output><empty_output><jupyter_text>by Pasting<jupyter_code>#paste an entry or continuous entries between """    """

ls_bib = []
s = """
@Misc{zaheer2021big,
  author        = {<NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME>},
  title         = {Big Bird: Transformers for Longer Sequences},
  year          = {2021},
  archiveprefix = {arXiv},
  eprint        = {2007.14062},
  file          = {:Ref/2007.14062.pdf:PDF},
  primaryclass  = {cs.LG},
}
"""

ls_bib.append(s)

# Prepare inputs, the input and output files are only this Colab session
fp_input = "input_pasted.bib"
#fp_output = "output.bib"
input_bib = open(fp_input, "w")

for bib in ls_bib:
  input_bib.write('\n'.join(re.split('\n\s+', bib)) + "\n\n")
input_bib.close()

ls_bibfiles = [fp_input]<jupyter_output><empty_output><jupyter_text>Step 3: PROCESS and PRINT<jupyter_code>#%%capture
# process input bib to output bib.

from IPython.utils import io

ls_output = []
for fn in ls_bibfiles:
  fn_output = '{}_rebibed.bib'.format(fn.split('.bib')[0])
  ls_output.append(fn_output)
  with io.capture_output() as captured:
    !rebiber -i {fn} -o {fn_output}

# Print bib entries
for fn in ls_output:
  f = open(fn, 'r')
  rebibed_bib = f.read()
  f.close()
  print(rebibed_bib)<jupyter_output>@misc{zaheer2021big,
 archiveprefix = {arXiv},
 author = {<NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME> and <NAME>},
 eprint = {2007.14062},
 file = {:Ref/2007.14062.pdf:PDF},
 primaryclass = {cs.LG},
 title = {Big Bird: Transformers for Longer Sequences},
 year = {2021}
}<jupyter_text>Step 4 DOWNLOAD<jupyter_code># Run this cell to download processed outputs
for fn in ls_output:
  files.download(fn)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1275872721655854, 'fraction_numerical': 0.017608897126969416, 'mean_word_length': 4.802867383512544, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 42, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '542513', 'license': 'MIT', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1111, 'n_words': 335, 'path': 'run_rebiber_demo.ipynb', 'repo_name': 'Herais/rebiber', 'size': '3375'}