Repository: commons-text
Updated Branches:
  refs/heads/master 3ccdabb1e -> 376c7c4d8


Remove unused and empty Jaccard files and update distance method name


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

Branch: refs/heads/master
Commit: 548a7918ef57e2591c3d6aaa9bb3e42e17fa6cbe
Parents: 3ccdabb
Author: Bruno P. Kinoshita <brunodepau...@yahoo.com.br>
Authored: Sun Apr 12 23:30:02 2015 +1200
Committer: Bruno P. Kinoshita <brunodepau...@yahoo.com.br>
Committed: Sun Apr 12 23:30:02 2015 +1200

----------------------------------------------------------------------
 .../commons/text/similarity/CosineDistance.java |  2 +-
 .../text/similarity/JaccardDistance.java        | 21 --------------------
 .../commons/text/similarity/JaccardIndex.java   | 21 --------------------
 .../text/similarity/CosineDistanceTest.java     |  8 ++++----
 4 files changed, 5 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/548a7918/src/main/java/org/apache/commons/text/similarity/CosineDistance.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/text/similarity/CosineDistance.java 
b/src/main/java/org/apache/commons/text/similarity/CosineDistance.java
index 69cfad7..f9fcf39 100644
--- a/src/main/java/org/apache/commons/text/similarity/CosineDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/CosineDistance.java
@@ -41,7 +41,7 @@ public class CosineDistance implements StringMetric<Double> {
     private final CosineSimilarity cosineSimilarity = new CosineSimilarity();
 
     @Override
-    public Double compare(CharSequence left, CharSequence right) {
+    public Double apply(CharSequence left, CharSequence right) {
         CharSequence[] leftTokens = tokenizer.tokenize(left);
         CharSequence[] rightTokens = tokenizer.tokenize(right);
 

http://git-wip-us.apache.org/repos/asf/commons-text/blob/548a7918/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
deleted file mode 100644
index 7237244..0000000
--- a/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.text.similarity;
-
-public class JaccardDistance {
-
-}

http://git-wip-us.apache.org/repos/asf/commons-text/blob/548a7918/src/main/java/org/apache/commons/text/similarity/JaccardIndex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardIndex.java 
b/src/main/java/org/apache/commons/text/similarity/JaccardIndex.java
deleted file mode 100644
index ceaa468..0000000
--- a/src/main/java/org/apache/commons/text/similarity/JaccardIndex.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.text.similarity;
-
-public class JaccardIndex {
-
-}

http://git-wip-us.apache.org/repos/asf/commons-text/blob/548a7918/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java 
b/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
index 0d6879a..3912913 100644
--- a/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/CosineDistanceTest.java
@@ -49,10 +49,10 @@ public class CosineDistanceTest {
      */
     @Test
     public void testCosineDistance() {
-        assertEquals(Double.valueOf(0.5d), 
roundValue(cosineDistance.compare("the house", "da house")));
-        assertEquals(Double.valueOf(0.0d), 
roundValue(cosineDistance.compare("AB", "AB")));
-        assertEquals(Double.valueOf(1.0d), 
roundValue(cosineDistance.compare("AB", "BA")));
-        assertEquals(Double.valueOf(0.08d), roundValue(cosineDistance.compare(
+        assertEquals(Double.valueOf(0.5d), 
roundValue(cosineDistance.apply("the house", "da house")));
+        assertEquals(Double.valueOf(0.0d), 
roundValue(cosineDistance.apply("AB", "AB")));
+        assertEquals(Double.valueOf(1.0d), 
roundValue(cosineDistance.apply("AB", "BA")));
+        assertEquals(Double.valueOf(0.08d), roundValue(cosineDistance.apply(
                 "the boy was from tamana shi, kumamoto ken, and the girl was 
from rio de janeiro, rio",
                 "the boy was from tamana shi, kumamoto, and the boy was from 
rio de janeiro, rio de janeiro")));
     }

Reply via email to