14

假设我有这个 text =I love apples, kiwis, oranges and bananas和 searchString =kiwis and bananas一个相似性算法Jaccard index。如何有效地找到textsearchString.

基本上,我试图找到与我拥有的关键字列表匹配的部分文本(文本有很高的错误、拼写错误、额外的符号和空格)。

4

4 回答 4

5

Jaccard 索引是“幸运的”相似性算法,因为您可以更新它的新符号值,而无需重新计算所有以前的东西。因此,您可以将text结果索引值视为一系列差异。之后,问题可以简化为https://en.wikipedia.org/wiki/Maximum_subarray_problem

你的第二段怎么样,如果你正在做一些类似 NLP 的研究,我建议在进一步处理之前清理你的数据(尽可能删除那些额外的符号和空格)。这就是所谓的“拼写校正”,并且有大量不同的算法和库。要选择合适的一个,需要有关您的域的额外信息。

于 2016-09-16T13:11:59.513 回答
2

看一下叠瓦技术,并尝试找出相似之处。你可以点击这个链接: http: //nlp.stanford.edu/IR-book/html/htmledition/near-duplicates-and-shingling-1.html

例如,使用 9 shingle 并将每个子集与您的特定关键字进行比较

于 2016-09-16T13:11:11.387 回答
1

I Use Stemming and Levenshtein distance

This is the algorithm in action: https://wizsearch.wizsoft.com/index.php/demo/

This demo searches all wiki titles, try the "show search terms" option to see the Levenshtein distance and error correction algorithm in action.

于 2016-09-23T09:34:47.317 回答
0

每个查询词都会根据字典进行检查。如果在字典中未找到某个术语,则字典中的这些单词将显示为拼写建议,与所讨论的查询术语最相似。

相似度/编辑距离 由于两个词之间的相似度度量通常用于 Damerau-Levenshtein 距离https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance

其他几个参考

于 2016-10-01T16:36:55.520 回答