我有两个单词,我想计算它们之间的相似度,以便对它们是否重复进行排名。
如何使用深度学习/NLP 方法实现这一目标?
这里有一些解决文本相似性的方法
基于字符串的方法
- 给定 2 个句子字符串计算余弦相似度 https://stackoverflow.com/questions/15173225/calculate-cosine-similarity-given-2-sentence-strings
- https://github.com/seatgeek/thefuzz https://github.com/seatgeek/thefuzz
基于神经的方法
- https://huggingface.co/sentence-transformers https://huggingface.co/sentence-transformers
基于机器翻译的方法
- https://github.com/mjpost/sacrebleu/tree/master/sacrebleu https://github.com/mjpost/sacrebleu/tree/master/sacrebleu
- https://github.com/Unbabel/MT-Telescope https://github.com/Unbabel/MT-Telescope
- https://github.com/alvations/lightyear https://github.com/alvations/lightyear
但在考虑使用哪个库来衡量相似性之前,您应该尝试定义在相似性方面您想要衡量什么,
您是否试图找到语义相似性和句法差异?
-
The dog ate the biscuit
vs
The biscuit was eaten by the dog
您是否想找到词汇语义相似性?
-
This problem is driving me mad!
vs
This problem is making me angry!
您是否试图寻找蕴涵而不是相似性?
-
I ate Chinese food for dinner
vs
I ate kungpao chicken for dinner
当在没有上下文的情况下比较单个单词时,“相似性”的歧义变得更加复杂,例如
人们可以根据您想要使用相似性分数执行的最终任务来定义相似性的许多其他方面。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)