Spacy词汇中的单词,但没有相关的向量
我培训了一个模型,但是当我无法检索NLP识别并在其词汇中的实体的向量时。
我的理解是,无论是从自定义模型还是预验证的模型中,一个词汇中的每个单词都与向量相关联?
例子:
sample_string = "DNP is a thing."
for ent in doc.ents:
print(f"Named Entity '{ent.text}' with label '{ent.label_}'")
#prints Named Entity 'DNP' with label 'SUBSTANCE'
print(nlp("DNP").vector) -> # []
print(nlp.vocab.strings["DNP"]) # -> 12623617258395969273
print(nlp.vocab.vectors[nlp.vocab.strings["DNP"]]) # -> Could not retrieve vector for key 12623617258395969273.'
print("DNP" in list(nlp.vocab.strings)) #-> True
I trained a model on curated text, but when I cannot retrieve vectors for entities that the nlp recognizes and are in its vocabulary.
My understanding is that every word in a SpaCy vocabulary, whether a from a custom or pretrained model, is associated with a vector?
Example:
sample_string = "DNP is a thing."
for ent in doc.ents:
print(f"Named Entity '{ent.text}' with label '{ent.label_}'")
#prints Named Entity 'DNP' with label 'SUBSTANCE'
print(nlp("DNP").vector) -> # []
print(nlp.vocab.strings["DNP"]) # -> 12623617258395969273
print(nlp.vocab.vectors[nlp.vocab.strings["DNP"]]) # -> Could not retrieve vector for key 12623617258395969273.'
print("DNP" in list(nlp.vocab.strings)) #-> True
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论