commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [3/4] [text] TEXT-2: Minor changes to Jaccard work
Date Wed, 30 Nov 2016 20:43:22 GMT
TEXT-2: Minor changes to Jaccard work


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

Branch: refs/heads/master
Commit: 96a6438f4801a063e472f4f72412ad435a70be73
Parents: 1cf3228
Author: Rob Tompkins <chtompki@gmail.com>
Authored: Tue Nov 29 19:24:21 2016 -0800
Committer: Rob Tompkins <chtompki@gmail.com>
Committed: Tue Nov 29 19:24:21 2016 -0800

----------------------------------------------------------------------
 pom.xml                                                  | 11 +++++------
 .../apache/commons/text/similarity/JaccardDistance.java  |  2 +-
 .../commons/text/similarity/JaccardSimilarity.java       |  2 +-
 .../commons/text/similarity/JaccardDistanceTest.java     |  1 +
 .../commons/text/similarity/JaccardSimilarityTest.java   |  1 +
 5 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/96a6438f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 02a0630..fa60302 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,14 +68,13 @@
       <id>ggregory</id>
       <email>ggregory@apache.org</email>
     </developer>
-    <developer>
-      <name>Don Jeba</name>
-      <id>drajakumar</id>
-      <email>donjeba@yahoo.com</email>
-    </developer>
   </developers>
-  <contributors>
 
+  <contributors>
+    <contributor>
+      <name>Don Jeba</name>
+      <email>donjeba@yahoo.com</email>
+    </contributor>
   </contributors>
 
   <!-- Lang should depend on very little -->

http://git-wip-us.apache.org/repos/asf/commons-text/blob/96a6438f/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java b/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
index 0c6d491..669382a 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
@@ -32,7 +32,7 @@ public class JaccardDistance implements EditDistance<Double> {
 
     /**
      * Calculates Jaccard distance of two set character sequence passed as
-     * input. Calculates Jaccard similarity and returns the complementary of it.
+     * input. Calculates Jaccard similarity and returns the complement of it.
      * 
      * @param left first character sequence
      * @param right second character sequence

http://git-wip-us.apache.org/repos/asf/commons-text/blob/96a6438f/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
index a87f478..7ccf91c 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
@@ -29,7 +29,7 @@ import java.util.Set;
  * https://en.wikipedia.org/wiki/Jaccard_index
  * </p>
  */
-public class JaccardSimilarity implements EditDistance<Double> {
+public class JaccardSimilarity implements SimilarityScore<Double> {
 
     /**
      * Calculates Jaccard Similarity of two set character sequence passed as

http://git-wip-us.apache.org/repos/asf/commons-text/blob/96a6438f/src/test/java/org/apache/commons/text/similarity/JaccardDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/JaccardDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/JaccardDistanceTest.java
index 4f3f55d..92c34ab 100644
--- a/src/test/java/org/apache/commons/text/similarity/JaccardDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/JaccardDistanceTest.java
@@ -47,6 +47,7 @@ public class JaccardDistanceTest {
         assertEquals(0.10d, classBeingTested.apply("PENNSYLVANIA", "PENNCISYLVNIA"), 0.0d);
         assertEquals(0.87d, classBeingTested.apply("left", "right"), 0.0d);
         assertEquals(0.87d, classBeingTested.apply("leettteft", "ritttght"), 0.0d);
+        assertEquals(0.0d, classBeingTested.apply("the same string", "the same string"),
0.0d);
     }
 
     @Test(expected = IllegalArgumentException.class)

http://git-wip-us.apache.org/repos/asf/commons-text/blob/96a6438f/src/test/java/org/apache/commons/text/similarity/JaccardSimilarityTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/JaccardSimilarityTest.java b/src/test/java/org/apache/commons/text/similarity/JaccardSimilarityTest.java
index 0e8773c..b87618b 100644
--- a/src/test/java/org/apache/commons/text/similarity/JaccardSimilarityTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/JaccardSimilarityTest.java
@@ -47,6 +47,7 @@ public class JaccardSimilarityTest {
         assertEquals(0.9d, classBeingTested.apply("PENNSYLVANIA", "PENNCISYLVNIA"), 0.0d);
         assertEquals(0.13d, classBeingTested.apply("left", "right"), 0.0d);
         assertEquals(0.13d, classBeingTested.apply("leettteft", "ritttght"), 0.0d);
+        assertEquals(1.0d, classBeingTested.apply("the same string", "the same string"),
0.0d);
     }
 
     @Test(expected = IllegalArgumentException.class)


Mime
View raw message