Я продолжаю получать сообщение о том, что в моем корпусе нет NER. Я ожидаю, что кошки, собаки и т. Д. Будут идентифицированы как личность. Дайте мне знать, как это исправить.
import numpy as np
import pandas as pd
import spacy
from spacy import displacy
nlp = spacy.load("en_core_web_sm")
corpus=['cats are selfish', 'it is raining cats and dogs', 'dogs do not like birds','i do not like rabbits','i have eaten frogs snakes and alligators']
for sent in corpus:
sentence_nlp = nlp(sent)
# print named entities in sentences
print([(word, word.ent_type_) for word in sentence_nlp if word.ent_type_])
# visualize named entities
displacy.render(sentence_nlp, style='ent', jupyter=True)
Я получаю ошибку:
[]
./NER_Spacy.py:19: UserWarning: [W006] No entities to visualize found in Doc object. If this is surprising to you, make sure the
Doc was processed using a model that supports named entity recognition, and check the `doc.ents` property manually if necessary
.
displacy.render(sentence_nlp, style='ent', jupyter=False)
[]
./NER_Spacy.py:19: UserWarning: [W006] No entities to visualize found in Doc object. If this is surprising to you, make sure the
Doc was processed using a model that supports named entity recognition, and check the `doc.ents` property manually if necessary
.
displacy.render(sentence_nlp, style='ent', jupyter=False)
[]
./NER_Spacy.py:19: UserWarning: [W006] No entities to visualize found in Doc object. If this is surprising to you, make sure the
Doc was processed using a model that supports named entity recognition, and check the `doc.ents` property manually if necessary
.
displacy.render(sentence_nlp, style='ent', jupyter=False)
[]
./NER_Spacy.py:19: UserWarning: [W006] No entities to visualize found in Doc object. If this is surprising to you, make sure the
Doc was processed using a model that supports named entity recognition, and check the `doc.ents` property manually if necessary
.
displacy.render(sentence_nlp, style='ent', jupyter=False)
[]
./NER_Spacy.py:19: UserWarning: [W006] No entities to visualize found in Doc object. If this is surprising to you, make sure the
Doc was processed using a model that supports named entity recognition, and check the `doc.ents` property manually if necessary
.
displacy.render(sentence_nlp, style='ent', jupyter=False) ```