text

text #

The text attribute allows you to get a processed text from the one saved in your NlgTools object with the write_text method.

nlg = NlgTools(lang='en')

text = 'In the    end , he     realized he could see    sound and    hear words .   '

nlg.write_text(text)
print(nlg.text)
# In the end, he realized he could see sound and hear words.
nlg = NlgTools(lang='fr')

text = 'à cause de le dépassement'

nlg.write_text(text)
print(nlg.text)
# À cause du dépassement

When accessing the text attribute, your text is modified as follow:

  • adds a capital letter after a dot
  • remove unnecessary spaces
  • adds spaces after a punctuation sign if needed
  • handle contractions (mostly for french)