What I would like to do
I would like to transform verbs from present tense to past tense with using NLP library like below.
As she leaves the kitchen, his voice follows her.
#output
As she left the kitchen, his voice followed her.
Problem
There is no way to transform from present tense to past tense.
I've checked the following similar question, but they only introduced the way to transform from past tense to present tense.
What I tried to do
I was able to transform verbs from past tense to present tense using spaCy. However, there is no clew to do the same thing from present tense to past tense.
text = "As she left the kitchen, his voice followed her."
doc_dep = nlp(text)
for i in range(len(doc_dep)):
token = doc_dep[i]
#print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_)
if token.pos_== 'VERB':
print(token.text)
print(token.lemma_)
text = text.replace(token.text, token.lemma_)
print(text)
#output
'As she leave the kitchen, his voice follow her.'
Development Environment
Python 3.7.0
spaCy version 2.3.1