How to link a verb in NLTK using a POS tag?

Given a POS tag such as VBD, how can I hide a verb to match with NLTK?

eg.

VERB: go POS: VBD RESULT: went 
+6
source share
2 answers

NLTK does not currently provide pairing. Pattern-en and nodebox do conjugation.

Sometimes the examples on the pattern-en website do not work as shown. This worked for me:

 >>> from pattern.en import conjugate >>> verb = "go" >>> conjugate(verb, ... tense = "past", # INFINITIVE, PRESENT, PAST, FUTURE ... person = 3, # 1, 2, 3 or None ... number = "singular", # SG, PL ... mood = "indicative", # INDICATIVE, IMPERATIVE, CONDITIONAL, SUBJUNCTIVE ... aspect = "imperfective", # IMPERFECTIVE, PERFECTIVE, PROGRESSIVE ... negated = False) # True or False u'went' >>> 

Note

It seems that conjugate is only output when time does not require an auxiliary verb. For example, in Spanish (single first person) the future is ir is iré. In English, the future go is formed with the help of auxiliary will, and the infinitive as a result. In the code below, iré is output, but not output.

 >>> from pattern.es import conjugate as conjugate_es >>> verb = "ir" >>> conjugate_es(verb, tense = "future") u'ir\xe1' >>> from pattern.en import conjugate as conjugate_en >>> verb = "go" >>> conjugate_en(verb, tense = "future") >>> 
+13
source

I used MontyLingua to inflect and conjugate words. https://pypi.python.org/pypi/MontyLingua/2.1

  mlg = MontyLingua.MontyNLGenerator.MontyNLGenerator() mlg.conjugate_verb(verb,mode) 

Additional information: https://en.wikipedia.org/wiki/MontyLingua

+1
source

Source: https://habr.com/ru/post/954339/


All Articles