【问题标题】:is there any method that will find nearest match有什么方法可以找到最近的匹配
【发布时间】:2011-05-24 12:02:52
【问题描述】:

我要比较两个字符串,比如:

 str1 = "this is a dynamic data";
 str2 = "this is a <data_1> data";

有什么方法可以找到最近的匹配吗?我使用了三元搜索树 (TST) 字典函数。还有其他方法可以做这种事情吗?

【问题讨论】:

标签: c# algorithm string comparison


【解决方案1】:

Jaccard similarity coefficient 呢? http://en.wikipedia.org/wiki/Jaccard_index

它很容易实现并且给出了很好的相似度分数。你必须标记你的句子;)

【讨论】:

    【解决方案2】:

    BCL 中没有这样的方法可以找到字符串的最接近匹配项。 但是你可以自己滚动。 在以下link

    上阅读“Levenshtein Distance

    【讨论】:

      【解决方案3】:

      我不确定 C# 中的这个东西,但是是的,在 SQL 中,

      select difference('this is a dynamic data','this is a dynamic')
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-10-01
        • 2010-12-23
        • 1970-01-01
        • 2011-03-01
        • 2014-01-31
        相关资源
        最近更新 更多