字符串相似性比较 [英] string similarity comparison

查看:93
本文介绍了字符串相似性比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来比较两个字符串并将它们评级为

相似度。


我的想法是删除常用词和标点符号并创建校验和
每个剩余字符串的
。然后我会比较校验和,如果它们是接近b
那么就有可能的匹配(用户互动判断)。


有人建议吗一个现有的函数或类来执行这样的任务?


谢谢!

解决方案

Bosconian写道:< blockquote class =post_quotes>我正在寻找一种方法来比较两个字符串并将它们分级为
相似性。



http://docs.php.net/en/function.levenshtein.html




http://docs.php.net/en/function.similar-text.html


干杯,

Nhcholas Sherlock


" Nicholas Sherlock" < N _ ******** @ hotmail.com>在消息中写道

news:d4 ********** @ lust.ihug.co.nz ...

Bosconian写道:

我正在寻找一种方法来比较两个字符串并将它们分级为
相似性。



http://docs.php.net/en/function.levenshtein.html


http:// docs.php.net/en/function.similar-text.html

干杯,
Nhcholas Sherlock




Nhcholas,我很尴尬地说我在发布

我的消息之前没有检查过php.net。对我感到羞耻,但感谢您的提示!


顺便说一句,您是否想知道是否可以在查询级别完成此事?


" Nicholas Sherlock" < N _ ******** @ hotmail.com>在消息中写道

news:d4 ********** @ lust.ihug.co.nz ...

Bosconian写道:

我正在寻找一种方法来比较两个字符串并将它们分级为
相似性。



http://docs.php.net/en/function.levenshtein.html


http:// docs.php.net/en/function.similar-text.html

干杯,
Nhcholas Sherlock


I''m looking for a method to compare two strings and grade them for
similarity.

My idea is to strip out common words and punctuation and create a checksum
of each remaining string. I would then compare the checksums and if they are
close then there''s a potential match (to be judged by user interaction.)

Can someone suggest an existing function or class to perform such a task?

Thanks!

解决方案

Bosconian wrote:

I''m looking for a method to compare two strings and grade them for
similarity.



http://docs.php.net/en/function.levenshtein.html

or

http://docs.php.net/en/function.similar-text.html

Cheers,
Nhcholas Sherlock


"Nicholas Sherlock" <n_********@hotmail.com> wrote in message
news:d4**********@lust.ihug.co.nz...

Bosconian wrote:

I''m looking for a method to compare two strings and grade them for
similarity.



http://docs.php.net/en/function.levenshtein.html

or

http://docs.php.net/en/function.similar-text.html

Cheers,
Nhcholas Sherlock



Nhcholas, I''m embarrassed to say that I didn''t check php.net before posting
my message. Shame on me, but thanks for the tip!


BTW, would you happen to know if this can be done at the query level?

"Nicholas Sherlock" <n_********@hotmail.com> wrote in message
news:d4**********@lust.ihug.co.nz...

Bosconian wrote:

I''m looking for a method to compare two strings and grade them for
similarity.



http://docs.php.net/en/function.levenshtein.html

or

http://docs.php.net/en/function.similar-text.html

Cheers,
Nhcholas Sherlock



这篇关于字符串相似性比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆