📜  Python| TextBlob.noun_phrases() 方法

📅  最后修改于: 2022-05-13 01:54:32.018000             🧑  作者: Mango

Python| TextBlob.noun_phrases() 方法

借助TextBlob.noun_phrases()方法,我们可以使用TextBlob.noun_phrases()方法获取句子的名词短语。

示例 #1:
在这个例子中,我们可以说通过使用TextBlob.noun_phrases()方法,我们可以获得名词词列表。

# import TextBlob
from textblob import TextBlob
  
gfg = TextBlob("Python is a high-level language.")
  
# using TextBlob.noun_phrases method
gfg = gfg.noun_phrases
  
print(gfg)

输出 :

示例 #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 TextBlob.noun_phrases method
gfg = gfg.noun_phrases
  
print(gfg)

输出 :