字符串相似性算法? [英] String similarity algorithms?
问题描述
我需要比较两个字符串,并计算出它们的相似性,过滤下来的最相似的字符串列表。
I need to compare 2 strings and calculate their similarity, to filter down a list of the most similar strings.
例如。搜索狗将返回
- 狗
- 该死的
- 在沼泽
- 雾
- 雾
例如。搜索破解将返回
- 破解
- 俏皮话
- 架
- 插孔
- 嘎嘎
我所遇到的:
- <一个href="http://orderedlist.com/our-writing/blog/articles/live-search-with-quicksilver-style/">QuickSilver
- 的Liquidmetal
- QuickSilver
- LiquidMetal
你知道的更多的字符串相似的算法?
Do you know of any more string similarity algorithms?
推荐答案
看来你需要某种形式的模糊匹配。这是java实现的一些设置相似度的<一个href="http://web.archive.org/web/20081224234350/http://www.dcs.shef.ac.uk/~sam/stringmetrics.html">http://www.dcs.shef.ac.uk/~sam/stringmetrics.html.这里是字符串指标的更详细的解释<一个href="http://www.cs.cmu.edu/~wcohen/postscript/ijcai-ws-2003.pdf">http://www.cs.cmu.edu/~wcohen/postscript/ijcai-ws-2003.pdf这取决于如何模糊,如何快速的实现必须。
It seems you are needing some kind of fuzzy matching. Here is java implementation of some set of similarity metrics http://www.dcs.shef.ac.uk/~sam/stringmetrics.html. Here is more detailed explanation of string metrics http://www.cs.cmu.edu/~wcohen/postscript/ijcai-ws-2003.pdf it depends on how fuzzy and how fast your implementation must be.
这篇关于字符串相似性算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!