You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2014/12/14 21:41:20 UTC

[1/8] [text] No need to add @since 1.0, since everything in the first release has been added 1.0

Repository: commons-text
Updated Branches:
  refs/heads/master 37c780400 -> 9b1b436b2


No need to add @since 1.0, since everything in the first release has been added 1.0


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

Branch: refs/heads/master
Commit: 7a81883e1bd8d5ef66577eea4c6124778cfa97dc
Parents: 182154e
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:01:34 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:01:34 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/commons/text/similarity/FuzzyDistance.java     | 2 --
 .../java/org/apache/commons/text/similarity/HammingDistance.java   | 2 --
 .../org/apache/commons/text/similarity/JaroWrinklerDistance.java   | 2 --
 .../org/apache/commons/text/similarity/LevenshteinDistance.java    | 2 --
 src/main/java/org/apache/commons/text/similarity/StringMetric.java | 1 -
 5 files changed, 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/7a81883e/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java b/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
index f4299ea..de21a75 100644
--- a/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
@@ -29,8 +29,6 @@ import java.util.Locale;
  * <p>
  * This code has been adapted from Apache Commons Lang 3.3.
  * </p>
- *
- * @since 1.0
  */
 public class FuzzyDistance implements StringMetric<Integer> {
 

http://git-wip-us.apache.org/repos/asf/commons-text/blob/7a81883e/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/HammingDistance.java b/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
index 13621b4..c7a1d63 100644
--- a/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
@@ -26,8 +26,6 @@ package org.apache.commons.text.similarity;
  * For further explanation about the hamming distance, take a look at its
  * Wikipedia page at http://en.wikipedia.org/wiki/Hamming_distance.
  * </p>
- *
- * @since 1.0
  */
 public class HammingDistance implements StringMetric<Integer> {
 

http://git-wip-us.apache.org/repos/asf/commons-text/blob/7a81883e/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java b/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
index 67aa2b8..9915caf 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
@@ -32,8 +32,6 @@ package org.apache.commons.text.similarity;
  * <p>
  * This code has been adapted from Apache Commons Lang 3.3.
  * </p>
- *
- * @since 1.0
  */
 public class JaroWrinklerDistance implements StringMetric<Double> {
 

http://git-wip-us.apache.org/repos/asf/commons-text/blob/7a81883e/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 cca3dc1..3d1264e 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -26,8 +26,6 @@ import java.util.Arrays;
  * <p>
  * This code has been adapted from Apache Commons Lang 3.3.
  * </p>
- *
- * @since 1.0
  */
 public class LevenshteinDistance implements StringMetric<Integer> {
 

http://git-wip-us.apache.org/repos/asf/commons-text/blob/7a81883e/src/main/java/org/apache/commons/text/similarity/StringMetric.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/StringMetric.java b/src/main/java/org/apache/commons/text/similarity/StringMetric.java
index 6765bbd..4a94367 100644
--- a/src/main/java/org/apache/commons/text/similarity/StringMetric.java
+++ b/src/main/java/org/apache/commons/text/similarity/StringMetric.java
@@ -27,7 +27,6 @@ package org.apache.commons.text.similarity;
  * </p>
  *
  * @param <R> return type of the edit distance
- * @since 1.0
  */
 public interface StringMetric<R> {
 


[3/8] [text] Better JavaDoc for FuzzyDistance

Posted by br...@apache.org.
Better JavaDoc for FuzzyDistance


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

Branch: refs/heads/master
Commit: 22e64f04c7f7cc0da7fb33a62a35c15fe4bc6e62
Parents: 49e60f0
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:19:02 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:19:02 2014 +0100

----------------------------------------------------------------------
 .../org/apache/commons/text/similarity/FuzzyDistance.java     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/22e64f04/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java b/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
index de21a75..6d0eab3 100644
--- a/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
@@ -19,10 +19,11 @@ package org.apache.commons.text.similarity;
 import java.util.Locale;
 
 /**
+ * A matching algorithm that is similar to the searching algorithms implemented in editors such
+ * as Sublime Text, TextMate, Atom and others.
+ *
  * <p>
- * This string matching algorithm is similar to the algorithms of editors such
- * as Sublime Text, TextMate, Atom and others. One point is given for every
- * matched character. Subsequent matches yield two bonus points. A higher score
+ * One point is given for every matched character. Subsequent matches yield two bonus points. A higher score
  * indicates a higher similarity.
  * </p>
  *


[4/8] [text] Better JavaDoc for HammingDistance

Posted by br...@apache.org.
Better JavaDoc for HammingDistance


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

Branch: refs/heads/master
Commit: 5fce7f89410b76cd5558eb9240b1f4d58ce1cd15
Parents: 22e64f0
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:27:04 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:27:04 2014 +0100

----------------------------------------------------------------------
 .../commons/text/similarity/HammingDistance.java   | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/5fce7f89/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/HammingDistance.java b/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
index c7a1d63..eb21307 100644
--- a/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/HammingDistance.java
@@ -17,26 +17,27 @@
 package org.apache.commons.text.similarity;
 
 /**
- * <p>
  * The hamming distance between two strings of equal length is the number of
  * positions at which the corresponding symbols are different.
- * </p>
  *
  * <p>
- * For further explanation about the hamming distance, take a look at its
+ * For further explanation about the Hamming Distance, take a look at its
  * Wikipedia page at http://en.wikipedia.org/wiki/Hamming_distance.
  * </p>
  */
 public class HammingDistance implements StringMetric<Integer> {
 
     /**
-     * <p>Find the hamming distance between two strings with the same
-     * length.</p>
+     * Find the Hamming Distance between two strings with the same
+     * length.
      *
      * <p>The distance starts with zero, and for each occurrence of a
      * different character in either String, it increments the distance
      * by 1, and finally return its value.</p>
      *
+     * <p>Since the Hamming Distance can only be calculated between strings of equal length, input of different lengths
+     * will throw IllegalArgumentException</p>
+     *
      * <pre>
      * distance.compare("", "")               = 0
      * distance.compare("pappa", "pappa")     = 0
@@ -45,10 +46,10 @@ public class HammingDistance implements StringMetric<Integer> {
      * distance.compare("karolin", "kerstin"  = 3
      * </pre>
      *
-     * @param left the first string, must not be null
-     * @param right the second string, must not be null
+     * @param left the first CharSequence, must not be null
+     * @param right the second CharSequence, must not be null
      * @return distance
-     * @throws IllegalArgumentException if either String input {@code null} or
+     * @throws IllegalArgumentException if either input is {@code null} or
      *             if they do not have the same length
      */
     @Override


[8/8] [text] Merge branch 'javadoc-fixes'

Posted by br...@apache.org.
Merge branch 'javadoc-fixes'


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

Branch: refs/heads/master
Commit: 9b1b436b2fd4862f1fcbf49dd589a33bd08b6779
Parents: 37c7804 2f995e0
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:40:13 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:40:13 2014 +0100

----------------------------------------------------------------------
 .../commons/text/similarity/FuzzyDistance.java  | 25 ++++---
 .../text/similarity/HammingDistance.java        | 19 +++---
 .../text/similarity/JaroWrinklerDistance.java   | 40 +++++------
 .../text/similarity/LevenshteinDistance.java    | 70 ++++++++------------
 .../commons/text/similarity/StringMetric.java   | 22 +++---
 5 files changed, 76 insertions(+), 100 deletions(-)
----------------------------------------------------------------------



[6/8] [text] Correct method names in JavaDoc after port from Lang

Posted by br...@apache.org.
Correct method names in JavaDoc after port from Lang


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

Branch: refs/heads/master
Commit: 1947f0ccf242670c683caaa68b17b42c53960dcd
Parents: 1d59629
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:35:05 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:35:05 2014 +0100

----------------------------------------------------------------------
 .../commons/text/similarity/FuzzyDistance.java  | 16 +++----
 .../text/similarity/JaroWrinklerDistance.java   | 28 ++++++-------
 .../text/similarity/LevenshteinDistance.java    | 44 ++++++++++----------
 3 files changed, 44 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/1947f0cc/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java b/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
index 6d0eab3..4d175a0 100644
--- a/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java
@@ -57,14 +57,14 @@ public class FuzzyDistance implements StringMetric<Integer> {
      * </p>
      *
      * <pre>
-     * distance.getFuzzyDistance(null, null, null)                                    = IllegalArgumentException
-     * distance.getFuzzyDistance("", "", Locale.ENGLISH)                              = 0
-     * distance.getFuzzyDistance("Workshop", "b", Locale.ENGLISH)                     = 0
-     * distance.getFuzzyDistance("Room", "o", Locale.ENGLISH)                         = 1
-     * distance.getFuzzyDistance("Workshop", "w", Locale.ENGLISH)                     = 1
-     * distance.getFuzzyDistance("Workshop", "ws", Locale.ENGLISH)                    = 2
-     * distance.getFuzzyDistance("Workshop", "wo", Locale.ENGLISH)                    = 4
-     * distance.getFuzzyDistance("Apache Software Foundation", "asf", Locale.ENGLISH) = 3
+     * distance.compare(null, null, null)                                    = IllegalArgumentException
+     * distance.compare("", "", Locale.ENGLISH)                              = 0
+     * distance.compare("Workshop", "b", Locale.ENGLISH)                     = 0
+     * distance.compare("Room", "o", Locale.ENGLISH)                         = 1
+     * distance.compare("Workshop", "w", Locale.ENGLISH)                     = 1
+     * distance.compare("Workshop", "ws", Locale.ENGLISH)                    = 2
+     * distance.compare("Workshop", "wo", Locale.ENGLISH)                    = 4
+     * distance.compare("Apache Software Foundation", "asf", Locale.ENGLISH) = 3
      * </pre>
      *
      * @param term a full term that should be matched against, must not be null

http://git-wip-us.apache.org/repos/asf/commons-text/blob/1947f0cc/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java b/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
index 3633d41..07fbc7e 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
@@ -47,20 +47,20 @@ public class JaroWrinklerDistance implements StringMetric<Double> {
      * between two CharSequences.
      *
      * <pre>
-     * distance.getJaroWinklerDistance(null, null)          = IllegalArgumentException
-     * distance.getJaroWinklerDistance("","")               = 0.0
-     * distance.getJaroWinklerDistance("","a")              = 0.0
-     * distance.getJaroWinklerDistance("aaapppp", "")       = 0.0
-     * distance.getJaroWinklerDistance("frog", "fog")       = 0.93
-     * distance.getJaroWinklerDistance("fly", "ant")        = 0.0
-     * distance.getJaroWinklerDistance("elephant", "hippo") = 0.44
-     * distance.getJaroWinklerDistance("hippo", "elephant") = 0.44
-     * distance.getJaroWinklerDistance("hippo", "zzzzzzzz") = 0.0
-     * distance.getJaroWinklerDistance("hello", "hallo")    = 0.88
-     * distance.getJaroWinklerDistance("ABC Corporation", "ABC Corp") = 0.91
-     * distance.getJaroWinklerDistance("D N H Enterprises Inc", "D &amp; H Enterprises, Inc.") = 0.93
-     * distance.getJaroWinklerDistance("My Gym Children's Fitness Center", "My Gym. Childrens Fitness") = 0.94
-     * distance.getJaroWinklerDistance("PENNSYLVANIA", "PENNCISYLVNIA")    = 0.9
+     * distance.compare(null, null)          = IllegalArgumentException
+     * distance.compare("","")               = 0.0
+     * distance.compare("","a")              = 0.0
+     * distance.compare("aaapppp", "")       = 0.0
+     * distance.compare("frog", "fog")       = 0.93
+     * distance.compare("fly", "ant")        = 0.0
+     * distance.compare("elephant", "hippo") = 0.44
+     * distance.compare("hippo", "elephant") = 0.44
+     * distance.compare("hippo", "zzzzzzzz") = 0.0
+     * distance.compare("hello", "hallo")    = 0.88
+     * distance.compare("ABC Corporation", "ABC Corp") = 0.91
+     * distance.compare("D N H Enterprises Inc", "D &amp; H Enterprises, Inc.") = 0.93
+     * distance.compare("My Gym Children's Fitness Center", "My Gym. Childrens Fitness") = 0.94
+     * distance.compare("PENNSYLVANIA", "PENNCISYLVNIA")    = 0.9
      * </pre>
      *
      * @param left the first String, must not be null

http://git-wip-us.apache.org/repos/asf/commons-text/blob/1947f0cc/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 3d1264e..5bd9d3e 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -57,17 +57,17 @@ public class LevenshteinDistance implements StringMetric<Integer> {
      * </p>
      *
      * <pre>
-     * distance.getLevenshteinDistance(null, *)             = IllegalArgumentException
-     * distance.getLevenshteinDistance(*, null)             = IllegalArgumentException
-     * distance.getLevenshteinDistance("","")               = 0
-     * distance.getLevenshteinDistance("","a")              = 1
-     * distance.getLevenshteinDistance("aaapppp", "")       = 7
-     * distance.getLevenshteinDistance("frog", "fog")       = 1
-     * distance.getLevenshteinDistance("fly", "ant")        = 3
-     * distance.getLevenshteinDistance("elephant", "hippo") = 7
-     * distance.getLevenshteinDistance("hippo", "elephant") = 7
-     * distance.getLevenshteinDistance("hippo", "zzzzzzzz") = 8
-     * distance.getLevenshteinDistance("hello", "hallo")    = 1
+     * distance.compare(null, *)             = IllegalArgumentException
+     * distance.compare(*, null)             = IllegalArgumentException
+     * distance.compare("","")               = 0
+     * distance.compare("","a")              = 1
+     * distance.compare("aaapppp", "")       = 7
+     * distance.compare("frog", "fog")       = 1
+     * distance.compare("fly", "ant")        = 3
+     * distance.compare("elephant", "hippo") = 7
+     * distance.compare("hippo", "elephant") = 7
+     * distance.compare("hippo", "zzzzzzzz") = 8
+     * distance.compare("hello", "hallo")    = 1
      * </pre>
      *
      * @param left the first string, must not be null
@@ -101,17 +101,17 @@ public class LevenshteinDistance implements StringMetric<Integer> {
      * </p>
      *
      * <pre>
-     * distance.getLevenshteinDistance(null, *, *)             = IllegalArgumentException
-     * distance.getLevenshteinDistance(*, null, *)             = IllegalArgumentException
-     * distance.getLevenshteinDistance(*, *, -1)               = IllegalArgumentException
-     * distance.getLevenshteinDistance("","", 0)               = 0
-     * distance.getLevenshteinDistance("aaapppp", "", 8)       = 7
-     * distance.getLevenshteinDistance("aaapppp", "", 7)       = 7
-     * distance.getLevenshteinDistance("aaapppp", "", 6))      = -1
-     * distance.getLevenshteinDistance("elephant", "hippo", 7) = 7
-     * distance.getLevenshteinDistance("elephant", "hippo", 6) = -1
-     * distance.getLevenshteinDistance("hippo", "elephant", 7) = 7
-     * distance.getLevenshteinDistance("hippo", "elephant", 6) = -1
+     * distance.compare(null, *, *)             = IllegalArgumentException
+     * distance.compare(*, null, *)             = IllegalArgumentException
+     * distance.compare(*, *, -1)               = IllegalArgumentException
+     * distance.compare("","", 0)               = 0
+     * distance.compare("aaapppp", "", 8)       = 7
+     * distance.compare("aaapppp", "", 7)       = 7
+     * distance.compare("aaapppp", "", 6))      = -1
+     * distance.compare("elephant", "hippo", 7) = 7
+     * distance.compare("elephant", "hippo", 6) = -1
+     * distance.compare("hippo", "elephant", 7) = 7
+     * distance.compare("hippo", "elephant", 6) = -1
      * </pre>
      *
      * @param left the first string, must not be null


[5/8] [text] Better JavaDoc for JaroWinklerDistance

Posted by br...@apache.org.
Better JavaDoc for JaroWinklerDistance


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

Branch: refs/heads/master
Commit: 1d5962978f0a863a2455d6a34b26aa565845c6c7
Parents: 5fce7f8
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:31:46 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:31:46 2014 +0100

----------------------------------------------------------------------
 .../commons/text/similarity/JaroWrinklerDistance.java     | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/1d596297/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java b/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
index 9915caf..3633d41 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaroWrinklerDistance.java
@@ -17,6 +17,8 @@
 package org.apache.commons.text.similarity;
 
 /**
+ * A similarity algorithm indicating the percentage of matched characters between two character sequences.
+ *
  * <p>
  * The Jaro measure is the weighted sum of percentage of matched characters
  * from each file and transposed characters. Winkler increased this measure
@@ -41,10 +43,8 @@ public class JaroWrinklerDistance implements StringMetric<Double> {
     public static final int INDEX_NOT_FOUND = -1;
 
     /**
-     * <p>
      * Find the Jaro Winkler Distance which indicates the similarity score
-     * between two Strings.
-     * </p>
+     * between two CharSequences.
      *
      * <pre>
      * distance.getJaroWinklerDistance(null, null)          = IllegalArgumentException
@@ -102,10 +102,8 @@ public class JaroWrinklerDistance implements StringMetric<Double> {
     }
 
     /**
-     * <p>
      * Compares all Strings in an array and returns the initial sequence of
      * characters that is common to all of them.
-     * </p>
      *
      * <p>
      * For example,
@@ -232,10 +230,8 @@ public class JaroWrinklerDistance implements StringMetric<Double> {
     }
 
     /**
-     * <p>
      * Compares all CharSequences in an array and returns the index at which the
      * CharSequences begin to differ.
-     * </p>
      *
      * <p>
      * For example,


[7/8] [text] Better JavaDoc for LevenshteinDistance

Posted by br...@apache.org.
Better JavaDoc for LevenshteinDistance


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

Branch: refs/heads/master
Commit: 2f995e0db2ee3a9a61f512c098f4d54466233b43
Parents: 1947f0c
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:39:43 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:39:43 2014 +0100

----------------------------------------------------------------------
 .../text/similarity/LevenshteinDistance.java    | 24 ++++++--------------
 1 file changed, 7 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/2f995e0d/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 5bd9d3e..4bc2e8a 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -19,8 +19,12 @@ package org.apache.commons.text.similarity;
 import java.util.Arrays;
 
 /**
+ * An algorithm for measuring the difference between two character sequences.
+ *
  * <p>
- * A string metric for measuring the difference between two sequences.
+ * This is the number of changes needed to change one sequence into another,
+ * where each change is a single character modification (deletion, insertion
+ * or substitution).
  * </p>
  *
  * <p>
@@ -30,15 +34,9 @@ import java.util.Arrays;
 public class LevenshteinDistance implements StringMetric<Integer> {
 
     /**
-     * <p>
      * Find the Levenshtein distance between two Strings.
-     * </p>
      *
-     * <p>
-     * This is the number of changes needed to change one String into another,
-     * where each change is a single character modification (deletion, insertion
-     * or substitution).
-     * </p>
+     * <p>A higher score indicates a greater distance.</p>
      *
      * <p>
      * The previous implementation of the Levenshtein distance algorithm was
@@ -81,16 +79,8 @@ public class LevenshteinDistance implements StringMetric<Integer> {
     }
 
     /**
-     * <p>
-     * Find the Levenshtein distance between two Strings if it's less than or
+     * Find the Levenshtein distance between two CharSequences if it's less than or
      * equal to a given threshold.
-     * </p>
-     *
-     * <p>
-     * This is the number of changes needed to change one String into another,
-     * where each change is a single character modification (deletion, insertion
-     * or substitution).
-     * </p>
      *
      * <p>
      * This implementation follows from Algorithms on Strings, Trees and


[2/8] [text] Clarify wording in StringMetric interface

Posted by br...@apache.org.
Clarify wording in StringMetric interface


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

Branch: refs/heads/master
Commit: 49e60f05a899edd2f4efa766b65d480ee278f1e3
Parents: 7a81883
Author: Benedikt Ritter <br...@apache.org>
Authored: Sun Dec 14 21:13:36 2014 +0100
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sun Dec 14 21:13:36 2014 +0100

----------------------------------------------------------------------
 .../commons/text/similarity/StringMetric.java   | 21 +++++++++-----------
 1 file changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/49e60f05/src/main/java/org/apache/commons/text/similarity/StringMetric.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/StringMetric.java b/src/main/java/org/apache/commons/text/similarity/StringMetric.java
index 4a94367..6c7b9ce 100644
--- a/src/main/java/org/apache/commons/text/similarity/StringMetric.java
+++ b/src/main/java/org/apache/commons/text/similarity/StringMetric.java
@@ -17,27 +17,24 @@
 package org.apache.commons.text.similarity;
 
 /**
- * <p>
- * Marker interface for <a
- * href='http://en.wikipedia.org/wiki/String_metric'>String Metrics</a>
- * </p>
+ * Interface for <a
+ * href='http://en.wikipedia.org/wiki/String_metric'>String Metrics</a>.
  *
  * <p>
- * A string metric measures the distance between two text strings.
+ * A string metric measures the distance between two character sequences. The higher the distance, the lesser the
+ * similarity between the two character sequences.
  * </p>
  *
- * @param <R> return type of the edit distance
+ * @param <R> The type of score used by this StringMetric.
  */
 public interface StringMetric<R> {
 
     /**
-     * <p>
-     * Compares two strings.
-     * </p>
+     * Compares two CharSequences.
      *
-     * @param left the first string
-     * @param right the second string
-     * @return result distance
+     * @param left the first CharSequence
+     * @param right the second CharSequence
+     * @return the distance between to two CharSequences
      */
     R compare(CharSequence left, CharSequence right);