[text] SANDBOX-488 remove distances from StringMetric javadocs for consistency
Repository: commons-text Updated Branches: refs/heads/master 93fb453cc - 9dd58bce9 SANDBOX-488 remove distances from StringMetric javadocs for consistency Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/9dd58bce Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/9dd58bce Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/9dd58bce Branch: refs/heads/master Commit: 9dd58bce9ca43b836ae0a8bd1916daad3f458327 Parents: 93fb453 Author: Bruno P. Kinoshita ki...@apache.org Authored: Sat Feb 14 11:21:30 2015 -0200 Committer: Bruno P. Kinoshita ki...@apache.org Committed: Sat Feb 14 11:21:30 2015 -0200 -- .../org/apache/commons/text/similarity/StringMetric.java | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/9dd58bce/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 6c7b9ce..fd6880a 100644 --- a/src/main/java/org/apache/commons/text/similarity/StringMetric.java +++ b/src/main/java/org/apache/commons/text/similarity/StringMetric.java @@ -17,15 +17,14 @@ package org.apache.commons.text.similarity; /** - * Interface for a - * href='http://en.wikipedia.org/wiki/String_metric'String Metrics/a. + * Interface for a href='http://en.wikipedia.org/wiki/String_metric'String Metrics/a. * * p - * A string metric measures the distance between two character sequences. The higher the distance, the lesser the - * similarity between the two character sequences. + * A string metric measures the similarity between two character sequences. Depending on + * the algorithm, higher values can mean closer strings, or more distant strings. * /p * - * @param R The type of score used by this StringMetric. + * @param R The type of similarity score unit used by this StringMetric. */ public interface StringMetricR { @@ -34,7 +33,7 @@ public interface StringMetricR { * * @param left the first CharSequence * @param right the second CharSequence - * @return the distance between to two CharSequences + * @return the similarity score between two CharSequences */ R compare(CharSequence left, CharSequence right);
[text] SANDBOX-488 rename FuzzyDistance to FuzzyScore
Repository: commons-text Updated Branches: refs/heads/master 9dd58bce9 - 1e7d2aa50 SANDBOX-488 rename FuzzyDistance to FuzzyScore Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/1e7d2aa5 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/1e7d2aa5 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/1e7d2aa5 Branch: refs/heads/master Commit: 1e7d2aa5057ad5e067ec9cd762ab8772546bc777 Parents: 9dd58bc Author: Bruno P. Kinoshita ki...@apache.org Authored: Sat Feb 14 13:56:55 2015 -0200 Committer: Bruno P. Kinoshita ki...@apache.org Committed: Sat Feb 14 13:56:55 2015 -0200 -- .../commons/text/similarity/FuzzyDistance.java | 133 --- .../commons/text/similarity/FuzzyScore.java | 133 +++ .../text/similarity/FuzzyDistanceTest.java | 75 --- .../commons/text/similarity/FuzzyScoreTest.java | 75 +++ 4 files changed, 208 insertions(+), 208 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/1e7d2aa5/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 deleted file mode 100644 index 4d175a0..000 --- a/src/main/java/org/apache/commons/text/similarity/FuzzyDistance.java +++ /dev/null @@ -1,133 +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; - -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 - * One point is given for every matched character. Subsequent matches yield two bonus points. A higher score - * indicates a higher similarity. - * /p - * - * p - * This code has been adapted from Apache Commons Lang 3.3. - * /p - */ -public class FuzzyDistance implements StringMetricInteger { - -/** - * p - * Find the Fuzzy Distance which indicates the similarity score between two - * Strings. This method uses the default locale. - * /p - * - * @param term a full term that should be matched against, must not be null - * @param query the query that will be matched against a term, must not be - *null - * @return result score - * @throws IllegalArgumentException if either String input {@code null} - */ -@Override -public Integer compare(CharSequence term, CharSequence query) { -return compare(term, query, Locale.getDefault()); -} - -/** - * p - * Find the Fuzzy Distance which indicates the similarity score between two - * Strings. - * /p - * - * pre - * 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 - * @param query the query that will be matched against a term, must not be - *null - * @param locale This string matching logic is case insensitive. A locale is - *necessary to normalize both Strings to lower case. - * @return result score - * @throws IllegalArgumentException if either String input {@code null} or - * Locale input {@code null} - */ -public
[2/2] [text] Jaccard index and distance
Jaccard index and 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/e099c56e Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/e099c56e Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/e099c56e Branch: refs/heads/NEW-METRICS Commit: e099c56ea1ce584f0aac9679ebcf51c4bdeec6fb Parents: 886bff0 Author: Bruno P. Kinoshita ki...@apache.org Authored: Sat Feb 14 14:23:54 2015 -0200 Committer: Bruno P. Kinoshita ki...@apache.org Committed: Sat Feb 14 14:23:54 2015 -0200 -- .../text/similarity/JaccardDistance.java| 21 .../commons/text/similarity/JaccardIndex.java | 21 2 files changed, 42 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/e099c56e/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 new file mode 100644 index 000..7237244 --- /dev/null +++ b/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java @@ -0,0 +1,21 @@ +/* + * 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/e099c56e/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 new file mode 100644 index 000..ceaa468 --- /dev/null +++ b/src/main/java/org/apache/commons/text/similarity/JaccardIndex.java @@ -0,0 +1,21 @@ +/* + * 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 { + +}
[1/2] [text] Coside similarity and distance
Repository: commons-text Updated Branches: refs/heads/NEW-METRICS [created] e099c56ea Coside similarity and 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/886bff09 Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/886bff09 Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/886bff09 Branch: refs/heads/NEW-METRICS Commit: 886bff091df593203ce79369a0180fd58d9d9a85 Parents: 1e7d2aa Author: Bruno P. Kinoshita ki...@apache.org Authored: Sat Feb 14 14:23:42 2015 -0200 Committer: Bruno P. Kinoshita ki...@apache.org Committed: Sat Feb 14 14:23:42 2015 -0200 -- .../commons/text/similarity/CosineDistance.java | 21 .../text/similarity/CosineSimilarity.java | 21 2 files changed, 42 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-text/blob/886bff09/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 new file mode 100644 index 000..ad19745 --- /dev/null +++ b/src/main/java/org/apache/commons/text/similarity/CosineDistance.java @@ -0,0 +1,21 @@ +/* + * 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 CosineDistance { + +} http://git-wip-us.apache.org/repos/asf/commons-text/blob/886bff09/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java -- diff --git a/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java b/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java new file mode 100644 index 000..4589c2d --- /dev/null +++ b/src/main/java/org/apache/commons/text/similarity/CosineSimilarity.java @@ -0,0 +1,21 @@ +/* + * 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 CosineSimilarity { + +}