我正在尝试为句子找到重要的名称实体,如下所示:
import spacy
nlp = spacy.load('en')
sentences = "The machine learning is a field within computer science,\
it differs from traditional computational approaches. In traditional computing,\
algorithms are sets of explicitly programmed instructions used by computers to \
calculate or problem solve. The Machine learning algorithms instead allow for computers \
to train on data inputs and use statistical analysis in order to output values that fall\
within a specific range. Because of this, machine learning facilitates computers in building\
models from sample data in order to automate decision-making processes based on data inputs."
doc = nlp(sentences)
print('Name Entity:{0}'.format(doc.ents))
我期望得到“机器学习”,“算法”,“决策”的结果,但是结果却是空的。我在这里做错什么了。
答案 0 :(得分:1)
spacy en模型仅为您提供自然实体,例如名称,位置,日期,ORG等。如果您需要一些自定义实体标签,则可以通过培训创建自己的自定义模型。有关自定义模型创建的更多信息,请遵循My another post.
答案 1 :(得分:1)
这些句子中没有实体。
尝试
import spacy
nlp = spacy.load('en_core_web_sm')
sentences = "The machine learning is a field within computer science,\
it differs from traditional computational approaches. In traditional computing,\
algorithms are sets of explicitly programmed instructions used by computers to \
calculate or problem solve. The achine learning algorithms instead allow for computers \
to train on data inputs and use statistical analysis in order to output values that fall\
within a specific range. Because of this, at Apple, machine learning facilitates computers in building\
models from sample data in order to automate decision-making processes based on data inputs."
doc = nlp(sentences)
print('Name Entity:{0}'.format(doc.ents))
答案 2 :(得分:0)