+

Python | TextBlob.noun_phrases () method

Using the TextBlob.noun_phrases() method, we can get the nominal phrases of sentences using TextBlob.noun_phrases () .

Syntax: TextBlob.noun_phrases ()
Return: Return list of noun values.

Example # 1:
In this example we can say that with TextBlob.noun_phrases () we can get a list of nouns .

# import TextBlob

from textblob import TextBlob

  

gfg = TextBlob ( "Python is a high-level la nguage. " )

  
# using the TextBlob.noun_phrases method

gfg = gfg.noun_phrases

  

print (gfg)

Output:

[`python`, `high-level language`]

Example # 2:

# import TextBlob

from textblob import TextBlob

 

gfg = TextBlob ( "Sandeep Jain An IIT Roorkee alumnus and founder of GeeksforGeeks. He loves to solve programming problems in most efficient ways. " )

  
# using the TextBlob.noun_phrases method

gfg = gfg.noun_phrases

 

print (gfg)

Output:

[`sandeep jain`, `iit roorkee`, `pythonengineering`, `efficient ways`]

Get Solution for free from DataCamp guru