为什么像西班牙语(es_dep_news_trf)这样的语言的空间转换器模型没有命名实体识别。
然而,对于英语(en_core_web_trf),它是这样的。
代码:
import spacy
nlp=spacy.load("en_core_web_trf")
doc=nlp("my name is John Smith and I work at Apple and I like visiting the Eiffel Tower")
print(doc.ents)
(John Smith, Apple, the Eiffel Tower)
我正试着训练新的实体为斯佩西纳。我尝试将我的新实体添加到现有的spacy 'en‘模型中。然而,这影响了'en'和我的新实体的预测模型。
因此,我建立了一个空白模型并训练了实体识别。这个效果很好。然而,它只能预测我训练过的对象,而不能预测常规的spacy实体识别。
比如说我把“马”训练成动物实体。
对于给定的文本
txt ='Did you know that George bought those horses for 10000 dollars?'
我期待着下列实体得到认可
George - PERSON
horses - ANIMAL
10000
我使用从文本中提取一些与我的问题相关的命名实体,例如日期、时间、GPE等等。
例如,我需要识别以下句子中的时区:
"Australian Central Time"
使用Spacy模型en_core_web_lg,我得到了以下结果:
doc = nlp("Australian Central Time")
print([(ent.label_, ent.text) for ent in doc.ents])
>> [('NORP', 'Australian')]
,我的问题是:我对实体NORP的确切含义不太清
我正在尝试使用Spacy从文档中删除命名实体。我没有发现任何识别命名实体的麻烦。使用以下代码:
ne = [(ent.text, ent.label_) for ent in doc.ents]
print(ne)
persons = [ent.text for ent in doc.ents if ent.label_ == 'PERSON']
print(persons)
输出:
'Timothy D. Cook',
'Peter',
'Peter',
'Benjamin A. Reitzes',
我正在使用SpaCy,以便从示例文本中提取不同的命名实体。问题是SpaCy没有识别所有预期的实体。它的钱和一些地点都有问题。这是我的密码:
# encoding: utf-8
import spacy
from spacy import displacy
nlp = spacy.load('es') #cargo el modelo en español.
text = u"Una vez un personaje le preguntó a Agustín Chirichigno si estaba en su casa. El nombre de este per
在spcay上对NER的描述意味着它有一个分类实体作为产品(车辆,食品等),但它们根本不被识别。知道我是不是错过了什么。我试过给出一些简单的句子,比如。sample_String =“我用车”,“我用手机”,“我午餐吃米饭”等
import spacy
import en_core_web_md
nlp = en_core_web_md.load()
a = nlp(" I eat rice for lunch")
for ent in a.ents:
print(a.text, a.start_char, a.end_char, a.label_)
输出为空(未执行打
我是一个初学者,我想知道是否有一种方法可以/如何使用字典手动添加标签来识别命名实体。我使用spacy进行命名实体识别,当我使用以下代码时: import spacy
from spacy import display
raw_text='''To determine the adulticidal and repellent activities of different solvent leafextracts of Rhinacanthus nasutus against Aedes aegypti and Culex quinquefasciatus.'
我正在尝试使用python制作一个聊天机器人,为此我使用Spacy进行实体识别,因此我安装了预建Spacy英语语言模型(Medium)来从用户话语中提取实体,但问题是,当我加载模型以从用户话语中提取实体时,需要31秒来加载模型,因为在我的情况下,我正在使聊天机器人的时间变得非常重要。需要你们所有人的一些指导吗,还有其他选择吗?任何帮助都将不胜感激
下面是从用户话语中提取实体的代码:
import spacy
import time
def extractEntity(userUtterance):
''' This funtion returns a list
我正在尝试训练Spacy3.0来识别新的非目标实体。我完全按照本文中指定的方式执行操作:
for text, annot in tqdm(TRAIN_DATA): # data in previous format
doc = nlp.make_doc(text) # create doc object from text
ents = []
for i in annot["entities"]:
start = i[0]
end = i[1]
label = i[2]
spa
我正致力于构建一个使用spacy来识别新实体的自定义NER,而不是spacy的NER。现在,我将使用spacy.Example标记和添加我的培训数据。我在使用BILOU计划。我的怀疑是,我有超过3个单词的实体。例如:
Housing Development Finance Corporation reported heavy losses in the past quarter.
我想把住房开发金融公司作为一个单一的实体,使用BILOU计划。有点像
'Housing' B-Entity
'Development' I-Entity
'Financ
谁能帮帮我。我有一个关于Spacy实体识别的问题 # import spacy
# define a language module
import spacy
nlp = spacy.load('en')
# create 5 garden path sentences
old_man = """The old man the boat."""
single_soldiers = """The complex houses married and single soldiers and their fa
如果一些命名实体是复合词,那么如何使用spaCy从文本中删除命名实体?
我知道在的问题,我相信这不是一个重复的问题,因为被接受的答案张贴在那里将失败,如果命名的实体是复合词。下面显示了为什么链接问题的公认答案失败的示例代码。
import spacy
nlp = spacy.load('en_core_web_sm')
text_data = 'This is a text document that speaks about entities like New York and Nokia'
document = nlp(text_data)
text
我知道训练spaCy模型(例如,命名实体识别)需要。但是,因为我需要在一个spaCy内部训练一个模型(可以简单地认为它是一个“纯Python脚本”),所以从中训练一个spaCy模型并不是我的用例的选择。我目前的尝试如下:
#train.py
# IMPORTANT: Assume all the necessary files are already available in the same directory than this script
import spacy
import subprocess
subprocess.run(["python", "-m
假设我有一个字符串,想要标记一些实体,比如组织。
string = I was working as a marketing executive for Bank of India, a 4 months..
string_tagged = I was working as a marketing executive for [Bank of India], a 4 months..
我想要识别标记的实体旁边的单词。如何定位被标记的实体的位置并提取实体旁边的单词?
我的代码:
import spacy
nlp = spacy.load('en')
doc = nlp(s
我想将Spacy中的文本匹配为以下模式:
如果有单词“dé提名”或“命名”,我想匹配下一个'MISC‘实体(实体名称来自Spacy),无论两者之间有什么。
例如:
text=" Some texte about a company, company number: 254455, Dénomination\n (entire name): NAME_OF_THE_COMPANY , \n, some other informations of the... "
我想提取"NAME_OF_COMPANY“,这是Spacy认可的实体
为了得到Spacy的