python-3.x - 使用 SPACY 查找匹配的公司名称
问题描述
例如,我有两个表,如下所示:(实际上我有巨大的数据集)
表格1:
|COMPANY|ADDRESS |
|BOSCH |18th main |
|Infra |19th main |
|AB |21st main |
表2:
|COMPANY|ADDRESS |
|BOSCH |18th main |
|Infran |20th main |
|AB |21st main |
现在,我如何使用 SPACY 来匹配两个表中的公司名称?要求是,如果 table1.company 与 table2.company 匹配,则结果应为 true,否则为 false。在地址的情况下也一样。
输出:匹配:
BOSCH BOSCH True
AB AB True
无与伦比:
Infra Infran False
也需要同样的地址
我已经尝试通过以下链接:
https://www.geeksforgeeks.org/python-word-similarity-using-spacy/
https://www.geeksforgeeks.org/python-named-entity-recognition-ner-using-spacy/
https://www.machinelearningplus.com/spacy-tutorial-nlp/#stringstohashes
我尝试使用 spacy 的示例代码:
import spacy
nlp = spacy.load('en_core_web_lg')
print("Enter two space-separated words")
words = input()
tokens = nlp(words)
for token in tokens:
# Printing the following attributes of each token.
# text: the word string, has_vector: if it contains
# a vector representation in the model,
# vector_norm: the algebraic norm of the vector,
# is_oov: if the word is out of vocabulary.
print(token.text, token.has_vector, token.vector_norm, token.is_oov)
token1, token2 = tokens[0], tokens[1]
print("Similarity:", token1.similarity(token2))
上面的代码给了我给定输入之间的相似度分数。
有人可以帮助我了解如何使用 SPACY 在 table2 中找出 table1 的匹配公司名称吗?或者有没有其他方法可以在 PYTHON 中找到匹配的公司名称及其地址?
解决方案
推荐阅读
- wordpress - VR 视频不再显示在任何设备上
- kotlin - 如何在序列化过程中为 kotlin 中的数据类中的字段保存大小写?
- c# - 使用 OpenXml-sdk 和 C# 访问 Word 文件的当前上下文中不存在名称“c”
- javascript - 如何提高我的 javascript 的质量 - 给定 2 个 json 格式数组
- python - 气流不会在失败时发送 dags 的电子邮件
- ansible - 向 Ansible 中的现有键添加值
- python - 如何永久存储用户输入以在将来添加到另一个变量?
- javascript - React JS 中没有显式的数据绑定
- django - 我怎么知道电子邮件是真正的电子邮件还是不使用 django 框架
- typescript - TypeScript 隐含泛型