Using NLTK and WordNet; how do I convert simple tense verb into its present, past or past participle form?

后端 未结 4 1910
悲哀的现实
悲哀的现实 2020-11-27 15:20

Using NLTK and WordNet, how do I convert simple tense verb into its present, past or past participle form?

For example:

I want to write a fu

4条回答
  •  借酒劲吻你
    2020-11-27 15:56

    For Python3:

    pip install pattern
    

    then

    from pattern.en import conjugate, lemma, lexeme,PRESENT,SG
    print (lemma('gave'))
    print (lexeme('gave'))
    print (conjugate(verb='give',tense=PRESENT,number=SG)) # he / she / it
    

    yields

    give ['give', 'gives', 'giving', 'gave', 'given'] gives

    thnks to @Agargara for pointing & authors of Pattern for their beautiful work, go support them ;-)

    PS. To use most of pattern's functionality in python 3.7+, you might want to use the trick described here

提交回复
热议问题