1. <legend id='ayais'><style id='ayais'><dir id='ayais'><q id='ayais'></q></dir></style></legend>
      <bdo id='ayais'></bdo><ul id='ayais'></ul>

    <i id='ayais'><tr id='ayais'><dt id='ayais'><q id='ayais'><span id='ayais'><b id='ayais'><form id='ayais'><ins id='ayais'></ins><ul id='ayais'></ul><sub id='ayais'></sub></form><legend id='ayais'></legend><bdo id='ayais'><pre id='ayais'><center id='ayais'></center></pre></bdo></b><th id='ayais'></th></span></q></dt></tr></i><div id='ayais'><tfoot id='ayais'></tfoot><dl id='ayais'><fieldset id='ayais'></fieldset></dl></div>
    <tfoot id='ayais'></tfoot>
  2. <small id='ayais'></small><noframes id='ayais'>

    1. 什么是匹配两个包含少于 10 个拉丁文单词的字符串的最佳算法

      What is the best algorithm for matching two string containing less than 10 words in latin script(什么是匹配两个包含少于 10 个拉丁文单词的字符串的最佳算法)
        <bdo id='xrHVq'></bdo><ul id='xrHVq'></ul>

          <small id='xrHVq'></small><noframes id='xrHVq'>

            <tbody id='xrHVq'></tbody>

          <tfoot id='xrHVq'></tfoot><legend id='xrHVq'><style id='xrHVq'><dir id='xrHVq'><q id='xrHVq'></q></dir></style></legend>
              1. <i id='xrHVq'><tr id='xrHVq'><dt id='xrHVq'><q id='xrHVq'><span id='xrHVq'><b id='xrHVq'><form id='xrHVq'><ins id='xrHVq'></ins><ul id='xrHVq'></ul><sub id='xrHVq'></sub></form><legend id='xrHVq'></legend><bdo id='xrHVq'><pre id='xrHVq'><center id='xrHVq'></center></pre></bdo></b><th id='xrHVq'></th></span></q></dt></tr></i><div id='xrHVq'><tfoot id='xrHVq'></tfoot><dl id='xrHVq'><fieldset id='xrHVq'></fieldset></dl></div>

                本文介绍了什么是匹配两个包含少于 10 个拉丁文单词的字符串的最佳算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在比较歌曲标题,使用拉丁脚本(尽管并非总是如此),我的目标是一种算法,如果两首歌曲标题似乎是相同的标题,则给出高分,如果它们什么都没有,则给出非常低的分数共同点.

                I'm comparing song titles, using Latin script (although not always), my aim is an algorithm that gives a high score if the two song titles seem to be the same same title and a very low score if they have nothing in common.

                现在我已经不得不使用 Lucene 和 RAMDirectory 编写代码 (Java) 来编写这个 - 但是仅使用 Lucene 来比较两个字符串太重,因此太慢了.我现在开始使用 https://github.com/nickmancol/simmetrics ,它有很多不错的算法比较两个字符串:

                Now I already had to code (Java) to write this using Lucene and a RAMDirectory - however using Lucene simply to compare two strings is too heavyweight and consequently too slow. I've now moved to using https://github.com/nickmancol/simmetrics which has many nice algorithms for comparing two strings:

                https://github.com/nickmancol/simmetrics/tree/master/src/main/java/uk/ac/shef/wit/simmetrics/similaritymetrics

                BlockDistance
                ChapmanLengthDeviation
                ChapmanMatchingSoundex
                ChapmanMeanLength
                ChapmanOrderedNameCompoundSimilarity
                CosineSimilarity
                DiceSimilarity
                EuclideanDistance
                InterfaceStringMetric
                JaccardSimilarity
                Jaro
                JaroWinkler
                Levenshtein
                MatchingCoefficient
                MongeElkan
                NeedlemanWunch
                OverlapCoefficient
                QGramsDistance
                SmithWaterman
                SmithWatermanGotoh
                SmithWatermanGotohWindowedAffine
                Soundex
                

                但我对这些算法并不精通,什么是好的选择?

                but I'm not well versed in these algorithms and what would be a good choice ?

                我认为 Lucene 以某种形式使用 CosineSimilarity,所以这是我的出发点,但我认为可能会有更好的东西.

                I think Lucene uses CosineSimilarity in some form, so that is my starting point but I think there might be something better.

                具体来说,该算法应该适用于短字符串,并且应该理解单词的概念,即应该对空格进行特殊处理.拉丁文字的良好匹配是最重要的,但其他文字(如韩文和中文)的良好匹配也是相关的,但我希望由于它们处理空格的方式而需要不同的算法.

                Specifically, the algorithm should work on short strings and should understand the concept of words, i.e spaces should be treated specially. Good matching of Latin script is most important, but good matching of other scripts such as Korean and Chinese is relevant as well but I expect would need different algorithm because of the way they treat spaces.

                推荐答案

                他们都很好.它们作用于字符串的不同属性并具有不同的匹配属性.最适合您的取决于您的需求.

                They're all good. They work on different properties of strings and have different matching properties. What works best for you depends on what you need.

                我正在使用 JaccardSimilarity 来匹配名称.我选择 JaccardSimilarity 是因为它相当快,而且对于短字符串而言,它擅长将名称与常见的错字匹配,同时迅速降低其他任何东西的分数.给空间额外的重量.它也对词序不敏感.我需要这种行为,因为误报的影响比误报的影响要大得多,空格可能是拼写错误,但不常见,而且词序并不那么重要.

                I'm using the JaccardSimilarity to match names. I chose the JaccardSimilarity because it was reasonably fast and for short strings excelled in matching names with common typo's while quickly degrading the score for anything else. Gives extra weight to spaces. It is also insensitive to word order. I needed this behavior because the impact of a false positive was much much higher then that off a false negative, spaces could be typos but not often and word order was not that important.

                请注意,这是结合删除非变音符号的简化器和将剩余字符映射到 a-z 范围的映射器完成的.这是通过将所有单词分隔符标准化为单个空格的规范化传递的.最后,解析名称以挑选出首字母、前缀和后缀.这是因为名称具有一种结构和格式,它对字符串比较具有相当的抵抗力.

                Note that this was done in combination with a simplifier that removes non-diacritics and a mapper that maps the remaining characters to the a-z range. This is passed through a normalizes that standardizes all word separator symbols to a single space. Finally the names are parsed to pick out initials, pre- inner- and suffixes. This because names have a structure and format to them that is rather resistant to just string comparison.

                要做出选择,您需要列出您想要的标准,然后寻找满足这些标准的算法.您还可以创建一个相当大的测试集并在该测试集上运行所有算法,看看在时间、阳性数、假阳性、假阴性和阴性数方面的权衡是什么,您的系统应该处理的错误类别,等等,等等.

                To make your choice you need to make a list of what criteria you want and then look for an algorithm that satisfied those criteria. You can also make a reasonably large test set and run all algorithms on that test set too see what the trade offs are with respect to time, number of positives, false positives, false negatives and negatives, the classes of errors your system should handle, ect, ect.

                如果您仍然不确定自己的选择,您还可以设置系统以在运行时切换精确的比较算法.这使您可以进行 A-B 测试并查看哪种算法在实践中效果最佳.

                If you are still unsure of your choice, you can also setup your system to switch the exact comparison algorithms at run time. This allows you to do an A-B test and see which algorithm works best in practice.

                TLDR;您想要哪种算法取决于您需要什么,如果您不知道自己需要什么,请确保您可以稍后更改它并即时运行测试.

                TLDR; which algorithm you want depends on what you need, if you don't know what you need make sure you can change it later on and run tests on the fly.

                这篇关于什么是匹配两个包含少于 10 个拉丁文单词的字符串的最佳算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                  • <bdo id='02H67'></bdo><ul id='02H67'></ul>

                    1. <small id='02H67'></small><noframes id='02H67'>

                      <legend id='02H67'><style id='02H67'><dir id='02H67'><q id='02H67'></q></dir></style></legend>
                      <i id='02H67'><tr id='02H67'><dt id='02H67'><q id='02H67'><span id='02H67'><b id='02H67'><form id='02H67'><ins id='02H67'></ins><ul id='02H67'></ul><sub id='02H67'></sub></form><legend id='02H67'></legend><bdo id='02H67'><pre id='02H67'><center id='02H67'></center></pre></bdo></b><th id='02H67'></th></span></q></dt></tr></i><div id='02H67'><tfoot id='02H67'></tfoot><dl id='02H67'><fieldset id='02H67'></fieldset></dl></div>
                        <tbody id='02H67'></tbody>

                          <tfoot id='02H67'></tfoot>