Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the infinitive form of the verb using NLTK (pos tagging)

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
like image 332
Christian V Avatar asked Mar 18 '12 23:03

Christian V


People also ask

What is JJ in POS tagging?

IN preposition/subordinating conjunction. JJ adjective 'big' JJR adjective, comparative 'bigger' JJS adjective, superlative 'biggest'

How do you use POS tags in Python?

Parts of Speech (POS) Tagging. Parts of speech tagging simply refers to assigning parts of speech to individual words in a sentence, which means that, unlike phrase matching, which is performed at the sentence or multi-word level, parts of speech tagging is performed at the token level.


1 Answers

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'
like image 82
Ambidextrous Avatar answered Sep 18 '22 00:09

Ambidextrous