【发布时间】:2020-06-08 23:58:16
【问题描述】:
使用 spacy 时,您可以轻松地遍历文本的 noun_phrases,如下所示:
S='This is an example sentence that should include several parts and also make clear that studying Natural language Processing is not difficult'
nlp = spacy.load('en_core_web_sm')
doc = nlp(S)
[chunk.text for chunk in doc.noun_chunks]
# = ['an example sentence', 'several parts', 'Natural language Processing']
你也可以得到名词块的“根”:
[chunk.root.text for chunk in doc.noun_chunks]
# = ['sentence', 'parts', 'Processing']
如何获得每个单词的词性(即使名词短语的词根始终是名词),以及如何获得该特定单词的引理、形状和单数单词。
这可能吗?
谢谢。
【问题讨论】:
标签: nlp root spacy chunks lemmatization