You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2018/08/08 16:21:15 UTC

[1/4] [text] Add optimization to limited levenshtein distance

Repository: commons-text
Updated Branches:
  refs/heads/master 802258f63 -> 97d606405


Add optimization to limited levenshtein distance


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/6b85ebeb
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/6b85ebeb
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/6b85ebeb

Branch: refs/heads/master
Commit: 6b85ebeb0bb999d3dc158c4afb0f8ae4c6eeacac
Parents: 6ad5771
Author: Luciano Quintabani <lq...@medallia.com>
Authored: Sun Jul 15 17:10:51 2018 -0300
Committer: Luciano Quintabani <lq...@medallia.com>
Committed: Sun Jul 15 17:10:51 2018 -0300

----------------------------------------------------------------------
 .../org/apache/commons/text/similarity/LevenshteinDistance.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/6b85ebeb/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
index 68c13cb..f0f2874 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -241,6 +241,11 @@ public class LevenshteinDistance implements EditDistance<Integer> {
             m = right.length();
         }
 
+        // the edit distance cannot be less than the length difference
+        if (m - n > threshold) {
+            return -1;
+        }
+
         int[] p = new int[n + 1]; // 'previous' cost array, horizontally
         int[] d = new int[n + 1]; // cost array, horizontally
         int[] tempD; // placeholder to assist in swapping p and d


[3/4] [text] Merge branch 'master' of https://github.com/luciano-medallia/commons-text

Posted by ch...@apache.org.
Merge branch 'master' of https://github.com/luciano-medallia/commons-text


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/e2e06886
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/e2e06886
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/e2e06886

Branch: refs/heads/master
Commit: e2e068861d63d51b25420004bedfa2ea093e0723
Parents: 802258f a7045b5
Author: Rob Tompkins <ch...@gmail.com>
Authored: Wed Aug 8 12:18:51 2018 -0400
Committer: Rob Tompkins <ch...@gmail.com>
Committed: Wed Aug 8 12:18:51 2018 -0400

----------------------------------------------------------------------
 .../commons/text/similarity/LevenshteinDistance.java     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[4/4] [text] Add Luciao Medallia as a contributor

Posted by ch...@apache.org.
Add Luciao Medallia as a contributor


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/97d60640
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/97d60640
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/97d60640

Branch: refs/heads/master
Commit: 97d60640563f15c40123205791deeb2dfd7a83b8
Parents: e2e0688
Author: Rob Tompkins <ch...@gmail.com>
Authored: Wed Aug 8 12:21:07 2018 -0400
Committer: Rob Tompkins <ch...@gmail.com>
Committed: Wed Aug 8 12:21:07 2018 -0400

----------------------------------------------------------------------
 pom.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/97d60640/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d8f2032..d7a3df1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -351,6 +351,9 @@
     <contributor>
       <name>Jostein Tveit</name>
     </contributor>
+    <contributor>
+      <name>Luciano Medallia</name>
+    </contributor>
   </contributors>
 
   <scm>


[2/4] [text] Remove obsolete conditional

Posted by ch...@apache.org.
Remove obsolete conditional


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/a7045b5d
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/a7045b5d
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/a7045b5d

Branch: refs/heads/master
Commit: a7045b5df428284762f2bb9cc4e22422f33d0d73
Parents: 6b85ebe
Author: Luciano Quintabani <lq...@medallia.com>
Authored: Sun Jul 15 18:04:49 2018 -0300
Committer: Luciano Quintabani <lq...@medallia.com>
Committed: Sun Jul 15 18:04:49 2018 -0300

----------------------------------------------------------------------
 .../apache/commons/text/similarity/LevenshteinDistance.java    | 6 ------
 1 file changed, 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/a7045b5d/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
index f0f2874..d509a25 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -270,12 +270,6 @@ public class LevenshteinDistance implements EditDistance<Integer> {
             final int max = j > Integer.MAX_VALUE - threshold ? n : Math.min(
                     n, j + threshold);
 
-            // the stripe may lead off of the table if s and t are of different
-            // sizes
-            if (min > max) {
-                return -1;
-            }
-
             // ignore entry left of leftmost
             if (min > 1) {
                 d[min - 1] = Integer.MAX_VALUE;