Please suggest the best approach to convert texts to past tense.
I tried using spacy with "en_core_web_sm" model which was not very efficient. Text - text = "The primary purpose of this Phase 3 study is to confirm the clinical benefits of poziotinib in a randomized study and to support the results from Phase 2 Study SPI-POZ-202 (ZENITH20) Cohort 2" Output - The primary purpose of this Phase 3 study is to confirmed the clinical benefits of poziotinib in a randomizeed study and to supported the results from Phase 2 Study SPI - POZ-202 ( ZENITH20 ) Cohort 2 .
i used pyinflect, and the output was:The primary purpose of thwas Phase 3 study was to confirm the clinical benefits of poziotinib in a randomized study and to support the results from Phase 2 Study SPI-POZ-202 (ZENITH20) Cohort 2.
it is converting this-thwas (considering present tense "is")
Tied using pattern.text.en, it seemed to give same results as the first one.
For converting text to past tense, you might want to try the tenseflow
library (see here), which is specifically designed for this task. Here’s a quick example of how to use it:
pip install tenseflow
Use it in code:
from tenseflow import tenseflow
text = "The primary purpose of this Phase 3 study is to confirm the clinical benefits of poziotinib in a randomized study and to support the results from Phase 2 Stud SPI-POZ-202 (ZENITH20) Cohort 2."
past_tense_text = tenseflow.to_past(text)
print(past_tense_text)
This should give you a more accurate conversion to past tense. If you encounter any issues or inaccuracies, you might need to manualy tweak the output or consider combining multiple methods for better results.