commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eli Lindsey (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-936) StringUtils.getLevenshteinDistance with too big of a threshold returns wrong result
Date Mon, 20 Jan 2014 18:53:30 GMT

    [ https://issues.apache.org/jira/browse/LANG-936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13876702#comment-13876702
] 

Eli Lindsey commented on LANG-936:
----------------------------------

Submitted a patch via github PR to handle this case - https://github.com/apache/commons-lang/pull/14

> StringUtils.getLevenshteinDistance with too big of a threshold returns wrong result
> -----------------------------------------------------------------------------------
>
>                 Key: LANG-936
>                 URL: https://issues.apache.org/jira/browse/LANG-936
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Yaniv Kunda
>            Priority: Minor
>             Fix For: Patch Needed
>
>
> StringUtils.getLevenshteinDistance(CharSequence s, CharSequence t, int threshold) specifies:
> {quote}
> {{Find the Levenshtein distance between two Strings if it's _+*less than or equal to*+_
a given threshold.}}
> {quote}
> When passing a threshold > *Integer.MAX_VALUE - max(s.length(), t.length())* the method
always returns -1.
> The simplest use case is passing *Integer.MAX_VALUE* (a common practice if one would
want to find the min/max LD of a string to several other strings in an iterative fashion.
> The code should be fixed to consider the threshold in relation to the source/target lengths,
or alternatively the javadoc should be fixed to pronounce the current limit.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message