Python ProgrammingPython Programming

How to extract Noun phrases using TextBlob?

The TextBlob's noun_phrases property returns a WordList object containing a list of Word objects which are noun phrase in the given text.


Extracting Noun Phrases

from textblob import TextBlob

#Extract noun
blob = TextBlob("Canada is a country in the northern part of North America.")

for nouns in blob.noun_phrases:
    print(nouns)

canada
northern part
america