Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ingest emnlp19 fix #736

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/latex_to_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ def latex_to_unicode(s):
s = s.replace(r"\textquotedblleft ", "“")
s = s.replace(r"\textquotedblright ", "”")

# Transform errant citations into "(CITATION)"
s = re.sub(r"\\(new)?cite.? ?\{([\w:-]+?)\}", r"(CITATION)", s)

# Remove errant \footnotes
s = re.sub(r"\\footnote ?\{.*?\}", "", s)

### Intentionally missing from latexcodec
s = s.replace(r"\$", "$")
s = s.replace(r"\&", "&")
Expand All @@ -185,7 +191,7 @@ def latex_to_unicode(s):
s = s.replace(r"\}", "}")

def repl(s):
logging.warning("discarding control sequence {}".format(s.group(0)))
logging.warning(f"discarding control sequence '{s.group(0)}' from '{s.string}'")
return ""

s = re.sub(r"\\[A-Za-z]+ |\\.", repl, s)
Expand Down
Loading