使用spacy报错TypeError: Argument ‘other‘ has incorrect type (expected spacy.tokens.token.Token, got str)

这是因为spacy返回是给了你一个对象,而不仅仅是文本。。。使用nlp时,请尝试:

sentence = 'The legislation allowed California to be admitted to the Union as what kind of state?'
doc = nlp(sentence)
for i in doc.noun_chunks:
    list_2.append(i.text)

# 注意这里的i后面要加text,即为i.text才可以。

你可能感兴趣的:(自然语言处理,学术研究,人工智能,自然语言处理)