I'm trying to learn natural language processing (of English) using NLTK and Python. Is there a way to get the infinitive form of the verb during or after POS-tagging.

For example:

  • is (VBZ) => to be
  • provided (VBN) => to provide
  • using (VBG) => to use
有帮助吗?

解决方案

Close, you'll need to add the 'to' at the beginning:

>>> from nltk.stem.wordnet import WordNetLemmatizer
>>> lemmatizer = WordNetLemmatizer()
>>> lemmatizer.lemmatize('is', 'v')
'be'
>>> lemmatizer.lemmatize('provided', 'v')
'provide'
>>> lemmatizer.lemmatize('using', 'v')
'use'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top