我正在尝试使用spacy noun_chunks,但是它引发了一个错误。我用python -m spacy download en_core_web_sm下载了模型
AttributeError: 'English' object has no attribute 'noun_chunks'
NLP = spacy.load('en_core_web_sm')
NOUN_CHUNKS = NLP.noun_chunks发布于 2019-03-06 13:54:38
你是怎么想出那个密码的?加载的nlp处理对象没有属性noun_chunks -相反,您希望访问处理文档的名词块。
nlp = spacy.load("en_core_web_sm") # load the English model
doc = nlp("There is a big dog.") # process a text and create a Doc object
for chunk in doc.noun_chunks: # iterate over the noun chunks in the Doc
print(chunk.text)
# 'a big dog'有关更多细节,请参见这里的文件。
https://stackoverflow.com/questions/54798604
复制相似问题