首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >spacy中的重要名称实体识别

spacy中的重要名称实体识别
EN

Stack Overflow用户
提问于 2019-12-09 14:08:23
回答 3查看 449关注 0票数 0

我正在尝试为一个句子找到重要的命名实体,如下所示:

代码语言:javascript
复制
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))

我期望得到“机器学习”,“算法”,“决策”的结果,但我得到的结果是一个空集。我到底做错了什么。

EN

回答 3

Stack Overflow用户

发布于 2019-12-09 14:54:51

spacy en model只给你提供像名字,地点,日期,ORG等自然实体。如果你想要一些自定义实体标签,那么你已经创建了你自己的带有训练的自定义模型。有关自定义模型创建的更多信息,请访问My another post.

票数 1
EN

Stack Overflow用户

发布于 2019-12-10 04:52:46

这些句子中没有实体。

试一试

代码语言:javascript
复制
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))
票数 1
EN

Stack Overflow用户

发布于 2019-12-10 15:22:25

当我运行代码时,这是我收到的输出

对于像“机器学习”,“算法”这样的输出,你需要定制spacy NER并进行相应的训练,.You可以为它使用正则表达式。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59243362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档