nlpifiedDoc = nlp(doc)
# Post-processing on tokenization:
#
# 1) collapse any LateXEquation123 tokens that have been split
#
for sent in nlpifiedDoc.sentences:
for i, w in enumerate(sent.words):
if 'LateXEquation' in w.text and not w.text[-1].isdigit():
w.text += sent.words[i+1].text
w.lemma += sent.words[i+1].lemma
#
# 2) Remove the numeric remnants
#
for i, w in enumerate(sent.words):
if w.text.isnumeric() and sent.words[i-1].text == 'LateXEquation'+w.text:
del sent.words[i]
#
# 3) Re-index the tokens in the sentence
#
for i, w in enumerate(sent.words):
w.index = i+1
# Then parse the dependencies
depped_doc = deps('\n'.join([' '.join([w.text for w in sent.words]) for sent in nlpifiedDoc.sentences]))