14

给定一个 POS 标签,例如 VBD,我如何结合动词来匹配 NLTK?

例如

VERB: go
POS: VBD
RESULT: went
4

2 回答 2

21

NLTK 目前不提供共轭。Pattern-en 和nodebox做共轭。

有时,pattern-en 网站中的示例无法正常工作。这对我有用:

>>> 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'
>>> 

笔记

似乎conjugate只在时态不需要助动词时才输出。例如,在西班牙语中,ir的(单数第一人称)未来是iré。在英语中,go的将来时由助动词will和不定式go组成,产生will go。在下面的代码中,iré是输出,但不会go

>>> 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")
>>> 
于 2013-09-22T16:03:37.990 回答
1

我使用 MontyLingua 进行词的变形和共轭。 https://pypi.python.org/pypi/MontyLingua/2.1

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

更多信息:https ://en.wikipedia.org/wiki/MontyLingua

于 2015-06-17T23:15:25.317 回答