You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@commons.apache.org by ki...@apache.org on 2015/04/17 08:46:32 UTC
svn commit: r947984 [24/36] - in
/websites/production/commons/content/sandbox/commons-text: ./ apidocs/
apidocs/org/apache/commons/text/diff/
apidocs/org/apache/commons/text/diff/class-use/
apidocs/org/apache/commons/text/names/ apidocs/org/apache/comm...
Added: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/CosineSimilarity.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/CosineSimilarity.html (added)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/CosineSimilarity.html Fri Apr 17 06:46:28 2015
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>CosineSimilarity</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">CosineSimilarity</span></div><h1>CosineSimilarity</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr>
<td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">8 of 133</td><td class="ctr2">94%</td><td class="bar">4 of 14</td><td class="ctr2">71%</td><td class="ctr1">4</td><td class="ctr2">11</td><td class
="ctr1">2</td><td class="ctr2">25</td><td class="ctr1">0</td><td class="ctr2">4</td></tr></tfoot><tbody><tr><td id="a1"><a href="CosineSimilarity.java.html#L44" class="el_method">cosineSimilarity(Map, Map)</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="11" height="10" title="8" alt="8"/><img src="../.resources/greenbar.gif" width="108" height="10" title="78" alt="78"/></td><td class="ctr2" id="c3">91%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="40" height="10" title="4" alt="4"/><img src="../.resources/greenbar.gif" width="80" height="10" title="8" alt="8"/></td><td class="ctr2" id="e1">67%</td><td class="ctr1" id="f0">4</td><td class="ctr2" id="g0">7</td><td class="ctr1" id="h0">2</td><td class="ctr2" id="i0">16</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="CosineSimilarity.java.html#L94" class="el_method">dot(Map, Map, Set)</a></td><td class="bar" id="b1"><img src="../.resource
s/greenbar.gif" width="43" height="10" title="31" alt="31"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d1"><img src="../.resources/greenbar.gif" width="20" height="10" title="2" alt="2"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g1">2</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">5</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a3"><a href="CosineSimilarity.java.html#L77" class="el_method">getIntersection(Map, Map)</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="18" height="10" title="13" alt="13"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">3</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a0"><a href="CosineSimilarity.java.html#L34" clas
s="el_method">CosineSimilarity()</a></td><td class="bar" id="b3"><img src="../.resources/greenbar.gif" width="4" height="10" title="3" alt="3"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i3">1</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
Added: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/CosineSimilarity.java.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/CosineSimilarity.java.html (added)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/CosineSimilarity.java.html Fri Apr 17 06:46:28 2015
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>CosineSimilarity.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.source.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_source">CosineSimilarity.java<
/span></div><h1>CosineSimilarity.java</h1><pre class="source lang-java linenums">/*
+ * 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.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Measures the Cosine similarity of two vectors of an inner product space and
+ * compares the angle between them.
+ *
+ * <p>
+ * For further explanation about the Cosine Similarity, refer to
+ * http://en.wikipedia.org/wiki/Cosine_similarity.
+ * </p>
+ *
+ * @since 1.0
+ */
+<span class="fc" id="L34">public class CosineSimilarity {</span>
+
+ /**
+ * Calculates the cosine similarity for two given vectors.
+ *
+ * @param leftVector left vector
+ * @param rightVector right vector
+ * @return cosine similarity between the two vectors
+ */
+ public Double cosineSimilarity(Map<CharSequence, Integer> leftVector, Map<CharSequence, Integer> rightVector) {
+<span class="pc bpc" id="L44" title="2 of 4 branches missed."> if (leftVector == null || rightVector == null) {</span>
+<span class="nc" id="L45"> throw new IllegalArgumentException("Vectors must not be null");</span>
+ }
+
+<span class="fc" id="L48"> Set<CharSequence> intersection = getIntersection(leftVector, rightVector);</span>
+
+<span class="fc" id="L50"> double dotProduct = dot(leftVector, rightVector, intersection);</span>
+<span class="fc" id="L51"> double d1 = 0.0d;</span>
+<span class="fc bfc" id="L52" title="All 2 branches covered."> for (Integer value : leftVector.values()) {</span>
+<span class="fc" id="L53"> d1 += Math.pow(value, 2);</span>
+<span class="fc" id="L54"> }</span>
+<span class="fc" id="L55"> double d2 = 0.0d;</span>
+<span class="fc bfc" id="L56" title="All 2 branches covered."> for (Integer value : rightVector.values()) {</span>
+<span class="fc" id="L57"> d2 += Math.pow(value, 2);</span>
+<span class="fc" id="L58"> }</span>
+ double cosineSimilarity;
+<span class="pc bpc" id="L60" title="2 of 4 branches missed."> if (d1 <= 0.0 || d2 <= 0.0) {</span>
+<span class="nc" id="L61"> cosineSimilarity = 0.0;</span>
+ } else {
+<span class="fc" id="L63"> cosineSimilarity = (double) (dotProduct / (double) (Math.sqrt(d1) * Math.sqrt(d2)));</span>
+ }
+<span class="fc" id="L65"> return cosineSimilarity;</span>
+ }
+
+ /**
+ * Returns a set with strings common to the two given maps.
+ *
+ * @param leftVector left vector map
+ * @param rightVector right vector map
+ * @return common strings
+ */
+ private Set<CharSequence> getIntersection(Map<CharSequence, Integer> leftVector,
+ Map<CharSequence, Integer> rightVector) {
+<span class="fc" id="L77"> Set<CharSequence> intersection = new HashSet<CharSequence>(leftVector.keySet());</span>
+<span class="fc" id="L78"> intersection.retainAll(rightVector.keySet());</span>
+<span class="fc" id="L79"> return intersection;</span>
+ }
+
+ /**
+ * Computes the dot product of two vectors. It ignores remaining elements. It means
+ * that if a vector is longer than other, then a smaller part of it will be used to compute
+ * the dot product.
+ *
+ * @param leftVector left vector
+ * @param rightVector right vector
+ * @param intersection common elements
+ * @return the dot product
+ */
+ private double dot(Map<CharSequence, Integer> leftVector, Map<CharSequence, Integer> rightVector,
+ Set<CharSequence> intersection) {
+<span class="fc" id="L94"> long dotProduct = 0;</span>
+<span class="fc bfc" id="L95" title="All 2 branches covered."> for (CharSequence key : intersection) {</span>
+<span class="fc" id="L96"> dotProduct += leftVector.get(key) * rightVector.get(key);</span>
+<span class="fc" id="L97"> }</span>
+<span class="fc" id="L98"> return dotProduct;</span>
+ }
+
+}
+</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
Added: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/EditDistanceFrom.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/EditDistanceFrom.html (added)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/EditDistanceFrom.html Fri Apr 17 06:46:28 2015
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>EditDistanceFrom</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">EditDistanceFrom</span></div><h1>EditDistanceFrom</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr>
<td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">6 of 29</td><td class="ctr2">79%</td><td class="bar">0 of 2</td><td class="ctr2">100%</td><td class="ctr1">2</td><td class="ctr2">5</td><td class="
ctr1">2</td><td class="ctr2">9</td><td class="ctr1">2</td><td class="ctr2">4</td></tr></tfoot><tbody><tr><td id="a3"><a href="EditDistanceFrom.java.html#L100" class="el_method">getLeft()</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="22" height="10" title="3" alt="3"/></td><td class="ctr2" id="c2">0%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i1">1</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="EditDistanceFrom.java.html#L109" class="el_method">getEditDistance()</a></td><td class="bar" id="b1"><img src="../.resources/redbar.gif" width="22" height="10" title="3" alt="3"/></td><td class="ctr2" id="c3">0%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f1">1</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h1">1</td><td class="ctr2" id="i
2">1</td><td class="ctr1" id="j1">1</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a1"><a href="EditDistanceFrom.java.html#L72" class="el_method">EditDistanceFrom(EditDistance, CharSequence)</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="120" height="10" title="16" alt="16"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"><img src="../.resources/greenbar.gif" width="120" height="10" title="2" alt="2"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g0">2</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i0">6</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a0"><a href="EditDistanceFrom.java.html#L91" class="el_method">apply(CharSequence)</a></td><td class="bar" id="b3"><img src="../.resources/greenbar.gif" width="52" height="10" title="7" alt="7"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d3"/><td class="ctr2" id="e3">n/a</td><td clas
s="ctr1" id="f3">0</td><td class="ctr2" id="g3">1</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i3">1</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
Added: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/EditDistanceFrom.java.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/EditDistanceFrom.java.html (added)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/EditDistanceFrom.java.html Fri Apr 17 06:46:28 2015
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>EditDistanceFrom.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.source.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_source">EditDistanceFrom.java<
/span></div><h1>EditDistanceFrom.java</h1><pre class="source lang-java linenums">/*
+ * 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;
+
+/**
+ * <p>
+ * This stores a {@link EditDistance} implementation and a {@link CharSequence} "left" string.
+ * The {@link #apply(CharSequence right)} method accepts the "right" string and invokes the
+ * comparison function for the pair of strings.
+ * </p>
+ *
+ * <p>
+ * The following is an example which finds the most similar string:
+ * </p>
+ * <pre>
+ * EditDistance&lt;Integer&gt; editDistance = new LevenshteinDistance();
+ * String target = "Apache";
+ * EditDistanceFrom&lt;Integer&gt; editDistanceFrom =
+ * new EditDistanceFrom&lt;Integer&gt;(editDistance, target);
+ * String mostSimilar = null;
+ * Integer shortestDistance = null;
+ *
+ * for (String test : new String[] { "Appaloosa", "a patchy", "apple" }) {
+ * Integer distance = editDistanceFrom.apply(test);
+ * if (shortestDistance == null || distance &lt; shortestDistance) {
+ * shortestDistance = distance;
+ * mostSimilar = test;
+ * }
+ * }
+ *
+ * System.out.println("The string most similar to \"" + target + "\" "
+ * + "is \"" + mostSimilar + "\" because "
+ * + "its distance is only " + shortestDistance + ".");
+ * </pre>
+ *
+ * @param <R> This is the type of similarity score used by the EditDistance function.
+ * @since 1.0
+ */
+public class EditDistanceFrom<R> {
+
+ /**
+ * Edit distance.
+ */
+ private final EditDistance<R> editDistance;
+ /**
+ * Left parameter used in distance function.
+ */
+ private final CharSequence left;
+
+ /**
+ * <p>This accepts the edit distance implementation and the "left" string.</p>
+ *
+ * @param editDistance This may not be null.
+ * @param left This may be null here,
+ * but the EditDistance#compare(CharSequence left, CharSequence right)
+ * implementation may not accept nulls.
+ */
+<span class="fc" id="L72"> public EditDistanceFrom(final EditDistance<R> editDistance, final CharSequence left) {</span>
+<span class="fc bfc" id="L73" title="All 2 branches covered."> if (editDistance == null) {</span>
+<span class="fc" id="L74"> throw new IllegalArgumentException("The edit distance may not be null.");</span>
+ }
+
+<span class="fc" id="L77"> this.editDistance = editDistance;</span>
+<span class="fc" id="L78"> this.left = left;</span>
+<span class="fc" id="L79"> }</span>
+
+ /**
+ * <p>
+ * This compares "left" field against the "right" parameter
+ * using the "edit distance" implementation.
+ * </p>
+ *
+ * @param right the second CharSequence
+ * @return the similarity score between two CharSequences
+ */
+ public R apply(CharSequence right) {
+<span class="fc" id="L91"> return editDistance.apply(left, right);</span>
+ }
+
+ /**
+ * Gets the left parameter.
+ *
+ * @return the left parameter
+ */
+ public CharSequence getLeft() {
+<span class="nc" id="L100"> return left;</span>
+ }
+
+ /**
+ * Gets the edit distance.
+ *
+ * @return the edit distance
+ */
+ public EditDistance<R> getEditDistance() {
+<span class="nc" id="L109"> return editDistance;</span>
+ }
+
+}
+</pre><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
Modified: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/FuzzyScore.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/FuzzyScore.html (original)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/FuzzyScore.html Fri Apr 17 06:46:28 2015
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>FuzzyScore</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">FuzzyScore</span></div><h1>FuzzyScore</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortabl
e" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">6 of 84</td><td class="ctr2">93%</td><td class="bar">0 of 16</td><td class="ctr2">100%</td><td class="ctr1">1</td><td class="ctr2">11</td><td class="ctr1">1</td><td
class="ctr2">23</td><td class="ctr1">1</td><td class="ctr2">3</td></tr></tfoot><tbody><tr><td id="a0"><a href="FuzzyScore.java.html#L50" class="el_method">compare(CharSequence, CharSequence)</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="9" height="10" title="6" alt="6"/></td><td class="ctr2" id="c2">0%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i1">1</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a1"><a href="FuzzyScore.java.html#L80" class="el_method">compare(CharSequence, CharSequence, Locale)</a></td><td class="bar" id="b1"><img src="../.resources/greenbar.gif" width="120" height="10" title="75" alt="75"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"><img src="../.resources/greenbar.gif" width="120" height="10" title="16" alt="16"/></td><td class="ctr2" id="e0">100%</t
d><td class="ctr1" id="f1">0</td><td class="ctr2" id="g0">9</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i0">21</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a2"><a href="FuzzyScore.java.html#L34" class="el_method">FuzzyScore()</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="4" height="10" title="3" alt="3"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">1</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>FuzzyScore</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">FuzzyScore</span></div><h1>FuzzyScore</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td class="sortabl
e" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">3 of 86</td><td class="ctr2">97%</td><td class="bar">0 of 16</td><td class="ctr2">100%</td><td class="ctr1">1</td><td class="ctr2">11</td><td class="ctr1">1</td><td
class="ctr2">26</td><td class="ctr1">1</td><td class="ctr2">3</td></tr></tfoot><tbody><tr><td id="a2"><a href="FuzzyScore.java.html#L141" class="el_method">getLocale()</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="5" height="10" title="3" alt="3"/></td><td class="ctr2" id="c2">0%</td><td class="bar" id="d2"/><td class="ctr2" id="e2">n/a</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g2">1</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i2">1</td><td class="ctr1" id="j0">1</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a0"><a href="FuzzyScore.java.html#L84" class="el_method">fuzzyScore(CharSequence, CharSequence)</a></td><td class="bar" id="b1"><img src="../.resources/greenbar.gif" width="120" height="10" title="70" alt="70"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"><img src="../.resources/greenbar.gif" width="120" height="10" title="14" alt="14"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f1">0
</td><td class="ctr2" id="g0">8</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i0">20</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a1"><a href="FuzzyScore.java.html#L52" class="el_method">FuzzyScore(Locale)</a></td><td class="bar" id="b2"><img src="../.resources/greenbar.gif" width="22" height="10" title="13" alt="13"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d1"><img src="../.resources/greenbar.gif" width="17" height="10" title="2" alt="2"/></td><td class="ctr2" id="e1">100%</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g1">2</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i1">5</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
Modified: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/FuzzyScore.java.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/FuzzyScore.java.html (original)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/FuzzyScore.java.html Fri Apr 17 06:46:28 2015
@@ -30,25 +30,31 @@ import java.util.Locale;
* <p>
* This code has been adapted from Apache Commons Lang 3.3.
* </p>
+ *
+ * @since 1.0
*/
-<span class="fc" id="L34">public class FuzzyScore implements StringMetric<Integer> {</span>
+public class FuzzyScore {
/**
- * <p>
- * Find the Fuzzy Score which indicates the similarity score between two
- * Strings. This method uses the default locale.
- * </p>
+ * Locale used to change the case of text.
+ */
+ private final Locale locale;
+
+
+ /**
+ * <p>This returns a {@link Locale}-specific {@link FuzzyScore}.</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}
+ * @param locale The string matching logic is case insensitive.
+ A {@link Locale} is necessary to normalize both Strings to lower case.
+ * @throws IllegalArgumentException
+ * This is thrown if the {@link Locale} parameter is {@code null}.
*/
- @Override
- public Integer compare(CharSequence term, CharSequence query) {
-<span class="nc" id="L50"> return compare(term, query, Locale.getDefault());</span>
- }
+<span class="fc" id="L52"> public FuzzyScore(final Locale locale) {</span>
+<span class="fc bfc" id="L53" title="All 2 branches covered."> if (locale == null) {</span>
+<span class="fc" id="L54"> throw new IllegalArgumentException("Locale must not be null");</span>
+ }
+<span class="fc" id="L56"> this.locale = locale;</span>
+<span class="fc" id="L57"> }</span>
/**
* <p>
@@ -57,77 +63,82 @@ import java.util.Locale;
* </p>
*
* <pre>
- * score.compare(null, null, null) = IllegalArgumentException
- * score.compare("", "", Locale.ENGLISH) = 0
- * score.compare("Workshop", "b", Locale.ENGLISH) = 0
- * score.compare("Room", "o", Locale.ENGLISH) = 1
- * score.compare("Workshop", "w", Locale.ENGLISH) = 1
- * score.compare("Workshop", "ws", Locale.ENGLISH) = 2
- * score.compare("Workshop", "wo", Locale.ENGLISH) = 4
- * score.compare("Apache Software Foundation", "asf", Locale.ENGLISH) = 3
+ * score.fuzzyScore(null, null, null) = IllegalArgumentException
+ * score.fuzzyScore("", "", Locale.ENGLISH) = 0
+ * score.fuzzyScore("Workshop", "b", Locale.ENGLISH) = 0
+ * score.fuzzyScore("Room", "o", Locale.ENGLISH) = 1
+ * score.fuzzyScore("Workshop", "w", Locale.ENGLISH) = 1
+ * score.fuzzyScore("Workshop", "ws", Locale.ENGLISH) = 2
+ * score.fuzzyScore("Workshop", "wo", Locale.ENGLISH) = 4
+ * score.fuzzyScore("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 Integer compare(CharSequence term, CharSequence query, Locale locale) {
-<span class="fc bfc" id="L80" title="All 4 branches covered."> if (term == null || query == null) {</span>
-<span class="fc" id="L81"> throw new IllegalArgumentException("Strings must not be null");</span>
-<span class="fc bfc" id="L82" title="All 2 branches covered."> } else if (locale == null) {</span>
-<span class="fc" id="L83"> throw new IllegalArgumentException("Locale must not be null");</span>
+ public Integer fuzzyScore(CharSequence term, CharSequence query) {
+<span class="fc bfc" id="L84" title="All 4 branches covered."> if (term == null || query == null) {</span>
+<span class="fc" id="L85"> throw new IllegalArgumentException("Strings must not be null");</span>
}
// fuzzy logic is case insensitive. We normalize the Strings to lower
// case right from the start. Turning characters to lower case
// via Character.toLowerCase(char) is unfortunately insufficient
// as it does not accept a locale.
-<span class="fc" id="L90"> final String termLowerCase = term.toString().toLowerCase(locale);</span>
-<span class="fc" id="L91"> final String queryLowerCase = query.toString().toLowerCase(locale);</span>
+<span class="fc" id="L92"> final String termLowerCase = term.toString().toLowerCase(locale);</span>
+<span class="fc" id="L93"> final String queryLowerCase = query.toString().toLowerCase(locale);</span>
// the resulting score
-<span class="fc" id="L94"> int score = 0;</span>
+<span class="fc" id="L96"> int score = 0;</span>
// the position in the term which will be scanned next for potential
// query character matches
-<span class="fc" id="L98"> int termIndex = 0;</span>
+<span class="fc" id="L100"> int termIndex = 0;</span>
// index of the previously matched character in the term
-<span class="fc" id="L101"> int previousMatchingCharacterIndex = Integer.MIN_VALUE;</span>
+<span class="fc" id="L103"> int previousMatchingCharacterIndex = Integer.MIN_VALUE;</span>
-<span class="fc bfc" id="L103" title="All 2 branches covered."> for (int queryIndex = 0; queryIndex < queryLowerCase.length(); queryIndex++) {</span>
-<span class="fc" id="L104"> final char queryChar = queryLowerCase.charAt(queryIndex);</span>
+<span class="fc bfc" id="L105" title="All 2 branches covered."> for (int queryIndex = 0; queryIndex < queryLowerCase.length(); queryIndex++) {</span>
+<span class="fc" id="L106"> final char queryChar = queryLowerCase.charAt(queryIndex);</span>
-<span class="fc" id="L106"> boolean termCharacterMatchFound = false;</span>
- for (; termIndex < termLowerCase.length()
-<span class="fc bfc" id="L108" title="All 4 branches covered."> && !termCharacterMatchFound; termIndex++) {</span>
-<span class="fc" id="L109"> final char termChar = termLowerCase.charAt(termIndex);</span>
+<span class="fc" id="L108"> boolean termCharacterMatchFound = false;</span>
+<span class="fc bfc" id="L109" title="All 4 branches covered."> for (; termIndex < termLowerCase.length()</span>
+<span class="fc" id="L110"> && !termCharacterMatchFound; termIndex++) {</span>
+<span class="fc" id="L111"> final char termChar = termLowerCase.charAt(termIndex);</span>
-<span class="fc bfc" id="L111" title="All 2 branches covered."> if (queryChar == termChar) {</span>
+<span class="fc bfc" id="L113" title="All 2 branches covered."> if (queryChar == termChar) {</span>
// simple character matches result in one point
-<span class="fc" id="L113"> score++;</span>
+<span class="fc" id="L115"> score++;</span>
// subsequent character matches further improve
// the score.
-<span class="fc bfc" id="L117" title="All 2 branches covered."> if (previousMatchingCharacterIndex + 1 == termIndex) {</span>
-<span class="fc" id="L118"> score += 2;</span>
+<span class="fc bfc" id="L119" title="All 2 branches covered."> if (previousMatchingCharacterIndex + 1 == termIndex) {</span>
+<span class="fc" id="L120"> score += 2;</span>
}
-<span class="fc" id="L121"> previousMatchingCharacterIndex = termIndex;</span>
+<span class="fc" id="L123"> previousMatchingCharacterIndex = termIndex;</span>
// we can leave the nested loop. Every character in the
// query can match at most one character in the term.
-<span class="fc" id="L125"> termCharacterMatchFound = true;</span>
+<span class="fc" id="L127"> termCharacterMatchFound = true;</span>
}
}
}
-<span class="fc" id="L130"> return score;</span>
+<span class="fc" id="L132"> return score;</span>
+ }
+
+ /**
+ * Gets the locale.
+ *
+ * @return the locale
+ */
+ public Locale getLocale() {
+<span class="nc" id="L141"> return locale;</span>
}
}
Modified: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/HammingDistance.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/HammingDistance.html (original)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/HammingDistance.html Fri Apr 17 06:46:28 2015
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>HammingDistance</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">HammingDistance</span></div><h1>HammingDistance</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td
class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">5 of 43</td><td class="ctr2">88%</td><td class="bar">1 of 10</td><td class="ctr2">90%</td><td class="ctr1">1</td><td class="ctr2">7</td><td class="ctr
1">1</td><td class="ctr2">10</td><td class="ctr1">0</td><td class="ctr2">2</td></tr></tfoot><tbody><tr><td id="a0"><a href="HammingDistance.java.html#L57" class="el_method">compare(CharSequence, CharSequence)</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="15" height="10" title="5" alt="5"/><img src="../.resources/greenbar.gif" width="105" height="10" title="35" alt="35"/></td><td class="ctr2" id="c1">88%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="12" height="10" title="1" alt="1"/><img src="../.resources/greenbar.gif" width="108" height="10" title="9" alt="9"/></td><td class="ctr2" id="e0">90%</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g0">6</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i0">9</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a1"><a href="HammingDistance.java.html#L28" class="el_method">HammingDistance()</a></td><td class="bar" id="b1"><img src="../.resourc
es/greenbar.gif" width="9" height="10" title="3" alt="3"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">1</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>HammingDistance</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">HammingDistance</span></div><h1>HammingDistance</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td
class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">5 of 43</td><td class="ctr2">88%</td><td class="bar">1 of 10</td><td class="ctr2">90%</td><td class="ctr1">1</td><td class="ctr2">7</td><td class="ctr
1">1</td><td class="ctr2">10</td><td class="ctr1">0</td><td class="ctr2">2</td></tr></tfoot><tbody><tr><td id="a0"><a href="HammingDistance.java.html#L59" class="el_method">apply(CharSequence, CharSequence)</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="15" height="10" title="5" alt="5"/><img src="../.resources/greenbar.gif" width="105" height="10" title="35" alt="35"/></td><td class="ctr2" id="c1">88%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="12" height="10" title="1" alt="1"/><img src="../.resources/greenbar.gif" width="108" height="10" title="9" alt="9"/></td><td class="ctr2" id="e0">90%</td><td class="ctr1" id="f0">1</td><td class="ctr2" id="g0">6</td><td class="ctr1" id="h0">1</td><td class="ctr2" id="i0">9</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a1"><a href="HammingDistance.java.html#L30" class="el_method">HammingDistance()</a></td><td class="bar" id="b1"><img src="../.resources
/greenbar.gif" width="9" height="10" title="3" alt="3"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d1"/><td class="ctr2" id="e1">n/a</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g1">1</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">1</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
Modified: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/HammingDistance.java.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/HammingDistance.java.html (original)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/HammingDistance.java.html Fri Apr 17 06:46:28 2015
@@ -24,8 +24,10 @@ package org.apache.commons.text.similari
* 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
*/
-<span class="fc" id="L28">public class HammingDistance implements StringMetric<Integer> {</span>
+<span class="fc" id="L30">public class HammingDistance implements EditDistance<Integer> {</span>
/**
* Find the Hamming Distance between two strings with the same
@@ -39,11 +41,11 @@ package org.apache.commons.text.similari
* will throw IllegalArgumentException</p>
*
* <pre>
- * distance.compare("", "") = 0
- * distance.compare("pappa", "pappa") = 0
- * distance.compare("1011101", "1011111") = 1
- * distance.compare("ATCG", "ACCC") = 2
- * distance.compare("karolin", "kerstin" = 3
+ * distance.apply("", "") = 0
+ * distance.apply("pappa", "pappa") = 0
+ * distance.apply("1011101", "1011111") = 1
+ * distance.apply("ATCG", "ACCC") = 2
+ * distance.apply("karolin", "kerstin" = 3
* </pre>
*
* @param left the first CharSequence, must not be null
@@ -53,24 +55,24 @@ package org.apache.commons.text.similari
* if they do not have the same length
*/
@Override
- public Integer compare(CharSequence left, CharSequence right) {
-<span class="fc bfc" id="L57" title="All 4 branches covered."> if (left == null || right == null) {</span>
-<span class="fc" id="L58"> throw new IllegalArgumentException("Strings must not be null");</span>
+ public Integer apply(CharSequence left, CharSequence right) {
+<span class="fc bfc" id="L59" title="All 4 branches covered."> if (left == null || right == null) {</span>
+<span class="fc" id="L60"> throw new IllegalArgumentException("Strings must not be null");</span>
}
-<span class="pc bpc" id="L61" title="1 of 2 branches missed."> if (left.length() != right.length()) {</span>
-<span class="nc" id="L62"> throw new IllegalArgumentException("Strings must have the same length");</span>
+<span class="pc bpc" id="L63" title="1 of 2 branches missed."> if (left.length() != right.length()) {</span>
+<span class="nc" id="L64"> throw new IllegalArgumentException("Strings must have the same length");</span>
}
-<span class="fc" id="L65"> int distance = 0;</span>
+<span class="fc" id="L67"> int distance = 0;</span>
-<span class="fc bfc" id="L67" title="All 2 branches covered."> for (int i = 0; i < left.length(); i++) {</span>
-<span class="fc bfc" id="L68" title="All 2 branches covered."> if (left.charAt(i) != right.charAt(i)) {</span>
-<span class="fc" id="L69"> distance++;</span>
+<span class="fc bfc" id="L69" title="All 2 branches covered."> for (int i = 0; i < left.length(); i++) {</span>
+<span class="fc bfc" id="L70" title="All 2 branches covered."> if (left.charAt(i) != right.charAt(i)) {</span>
+<span class="fc" id="L71"> distance++;</span>
}
}
-<span class="fc" id="L73"> return distance;</span>
+<span class="fc" id="L75"> return distance;</span>
}
}
Modified: websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/JaroWrinklerDistance.html
==============================================================================
--- websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/JaroWrinklerDistance.html (original)
+++ websites/production/commons/content/sandbox/commons-text/jacoco/org.apache.commons.text.similarity/JaroWrinklerDistance.html Fri Apr 17 06:46:28 2015
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>JaroWrinklerDistance</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">JaroWrinklerDistance</span></div><h1>JaroWrinklerDistance</h1><table class="coverage" cellspacing="0" id="coveragetable"
><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">27 of 376</td><td class="ctr2">93%</td><td class="bar">16 of 64</td><td class="ctr2">75%</td><td class="ctr1">14</td><td class="ctr2">4
0</td><td class="ctr1">10</td><td class="ctr2">82</td><td class="ctr1">0</td><td class="ctr2">8</td></tr></tfoot><tbody><tr><td id="a4"><a href="JaroWrinklerDistance.java.html#L266" class="el_method">indexOfDifference(CharSequence[])</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="14" height="10" title="13" alt="13"/><img src="../.resources/greenbar.gif" width="105" height="10" title="96" alt="96"/></td><td class="ctr2" id="c6">88%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="38" height="10" title="9" alt="9"/><img src="../.resources/greenbar.gif" width="81" height="10" title="19" alt="19"/></td><td class="ctr2" id="e5">68%</td><td class="ctr1" id="f0">8</td><td class="ctr2" id="g0">15</td><td class="ctr1" id="h0">5</td><td class="ctr2" id="i0">30</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="JaroWrinklerDistance.java.html#L139" class="el_method">getCommonPrefix(String[])</a></td><
td class="bar" id="b1"><img src="../.resources/redbar.gif" width="13" height="10" title="12" alt="12"/><img src="../.resources/greenbar.gif" width="24" height="10" title="22" alt="22"/></td><td class="ctr2" id="c7">65%</td><td class="bar" id="d1"><img src="../.resources/redbar.gif" width="21" height="10" title="5" alt="5"/><img src="../.resources/greenbar.gif" width="21" height="10" title="5" alt="5"/></td><td class="ctr2" id="e6">50%</td><td class="ctr1" id="f1">4</td><td class="ctr2" id="g1">6</td><td class="ctr1" id="h1">4</td><td class="ctr2" id="i3">10</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a6"><a href="JaroWrinklerDistance.java.html#L171" class="el_method">score(CharSequence, CharSequence)</a></td><td class="bar" id="b2"><img src="../.resources/redbar.gif" width="2" height="10" title="2" alt="2"/><img src="../.resources/greenbar.gif" width="94" height="10" title="86" alt="86"/></td><td class="ctr2" id="c5">98%</td><td class="bar" id=
"d2"><img src="../.resources/redbar.gif" width="8" height="10" title="2" alt="2"/><img src="../.resources/greenbar.gif" width="25" height="10" title="6" alt="6"/></td><td class="ctr2" id="e4">75%</td><td class="ctr1" id="f2">2</td><td class="ctr2" id="g2">5</td><td class="ctr1" id="h2">1</td><td class="ctr2" id="i1">15</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a3"><a href="JaroWrinklerDistance.java.html#L339" class="el_method">getSetOfMatchingCharacterWithin(CharSequence, CharSequence, int)</a></td><td class="bar" id="b3"><img src="../.resources/greenbar.gif" width="64" height="10" title="59" alt="59"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d3"><img src="../.resources/greenbar.gif" width="34" height="10" title="8" alt="8"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g3">5</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i2">12</td><td class="ctr1" id="j3">0</td><td clas
s="ctr2" id="k3">1</td></tr><tr><td id="a1"><a href="JaroWrinklerDistance.java.html#L73" class="el_method">compare(CharSequence, CharSequence)</a></td><td class="bar" id="b4"><img src="../.resources/greenbar.gif" width="42" height="10" title="39" alt="39"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d4"><img src="../.resources/greenbar.gif" width="17" height="10" title="4" alt="4"/></td><td class="ctr2" id="e1">100%</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g4">3</td><td class="ctr1" id="h4">0</td><td class="ctr2" id="i4">7</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr><tr><td id="a0"><a href="JaroWrinklerDistance.java.html#L97" class="el_method">commonPrefixLength(CharSequence, CharSequence)</a></td><td class="bar" id="b5"><img src="../.resources/greenbar.gif" width="24" height="10" title="22" alt="22"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d6"><img src="../.resources/greenbar.gif" width="8" height="10" titl
e="2" alt="2"/></td><td class="ctr2" id="e2">100%</td><td class="ctr1" id="f5">0</td><td class="ctr2" id="g6">2</td><td class="ctr1" id="h5">0</td><td class="ctr2" id="i6">2</td><td class="ctr1" id="j5">0</td><td class="ctr2" id="k5">1</td></tr><tr><td id="a7"><a href="JaroWrinklerDistance.java.html#L223" class="el_method">transpositions(CharSequence, CharSequence)</a></td><td class="bar" id="b6"><img src="../.resources/greenbar.gif" width="24" height="10" title="22" alt="22"/></td><td class="ctr2" id="c3">100%</td><td class="bar" id="d5"><img src="../.resources/greenbar.gif" width="17" height="10" title="4" alt="4"/></td><td class="ctr2" id="e3">100%</td><td class="ctr1" id="f6">0</td><td class="ctr2" id="g5">3</td><td class="ctr1" id="h6">0</td><td class="ctr2" id="i5">5</td><td class="ctr1" id="j6">0</td><td class="ctr2" id="k6">1</td></tr><tr><td id="a5"><a href="JaroWrinklerDistance.java.html#L38" class="el_method">JaroWrinklerDistance()</a></td><td class="bar" id="b7"><img src
="../.resources/greenbar.gif" width="3" height="10" title="3" alt="3"/></td><td class="ctr2" id="c4">100%</td><td class="bar" id="d7"/><td class="ctr2" id="e7">n/a</td><td class="ctr1" id="f7">0</td><td class="ctr2" id="g7">1</td><td class="ctr1" id="h7">0</td><td class="ctr2" id="i7">1</td><td class="ctr1" id="j7">0</td><td class="ctr2" id="k7">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>JaroWrinklerDistance</title><script type="text/javascript" src="../.resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons Text</a> > <a href="index.html" class="el_package">org.apache.commons.text.similarity</a> > <span class="el_class">JaroWrinklerDistance</span></div><h1>JaroWrinklerDistance</h1><table class="coverage" cellspacing="0" id="coveragetable"
><thead><tr><td class="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">27 of 380</td><td class="ctr2">93%</td><td class="bar">16 of 64</td><td class="ctr2">75%</td><td class="ctr1">14</td><td class="ctr2">4
0</td><td class="ctr1">10</td><td class="ctr2">87</td><td class="ctr1">0</td><td class="ctr2">8</td></tr></tfoot><tbody><tr><td id="a4"><a href="JaroWrinklerDistance.java.html#L275" class="el_method">indexOfDifference(CharSequence[])</a></td><td class="bar" id="b0"><img src="../.resources/redbar.gif" width="14" height="10" title="13" alt="13"/><img src="../.resources/greenbar.gif" width="105" height="10" title="96" alt="96"/></td><td class="ctr2" id="c6">88%</td><td class="bar" id="d0"><img src="../.resources/redbar.gif" width="38" height="10" title="9" alt="9"/><img src="../.resources/greenbar.gif" width="81" height="10" title="19" alt="19"/></td><td class="ctr2" id="e5">68%</td><td class="ctr1" id="f0">8</td><td class="ctr2" id="g0">15</td><td class="ctr1" id="h0">5</td><td class="ctr2" id="i0">30</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="JaroWrinklerDistance.java.html#L146" class="el_method">getCommonPrefix(String[])</a></td><
td class="bar" id="b1"><img src="../.resources/redbar.gif" width="13" height="10" title="12" alt="12"/><img src="../.resources/greenbar.gif" width="24" height="10" title="22" alt="22"/></td><td class="ctr2" id="c7">65%</td><td class="bar" id="d1"><img src="../.resources/redbar.gif" width="21" height="10" title="5" alt="5"/><img src="../.resources/greenbar.gif" width="21" height="10" title="5" alt="5"/></td><td class="ctr2" id="e6">50%</td><td class="ctr1" id="f1">4</td><td class="ctr2" id="g1">6</td><td class="ctr1" id="h1">4</td><td class="ctr2" id="i3">10</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a6"><a href="JaroWrinklerDistance.java.html#L178" class="el_method">score(CharSequence, CharSequence)</a></td><td class="bar" id="b2"><img src="../.resources/redbar.gif" width="2" height="10" title="2" alt="2"/><img src="../.resources/greenbar.gif" width="96" height="10" title="88" alt="88"/></td><td class="ctr2" id="c5">98%</td><td class="bar" id=
"d2"><img src="../.resources/redbar.gif" width="8" height="10" title="2" alt="2"/><img src="../.resources/greenbar.gif" width="25" height="10" title="6" alt="6"/></td><td class="ctr2" id="e4">75%</td><td class="ctr1" id="f2">2</td><td class="ctr2" id="g2">5</td><td class="ctr1" id="h2">1</td><td class="ctr2" id="i1">18</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a3"><a href="JaroWrinklerDistance.java.html#L348" class="el_method">getSetOfMatchingCharacterWithin(CharSequence, CharSequence, int)</a></td><td class="bar" id="b3"><img src="../.resources/greenbar.gif" width="64" height="10" title="59" alt="59"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d3"><img src="../.resources/greenbar.gif" width="34" height="10" title="8" alt="8"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g3">5</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i2">12</td><td class="ctr1" id="j3">0</td><td clas
s="ctr2" id="k3">1</td></tr><tr><td id="a0"><a href="JaroWrinklerDistance.java.html#L79" class="el_method">apply(CharSequence, CharSequence)</a></td><td class="bar" id="b4"><img src="../.resources/greenbar.gif" width="45" height="10" title="41" alt="41"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d4"><img src="../.resources/greenbar.gif" width="17" height="10" title="4" alt="4"/></td><td class="ctr2" id="e1">100%</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g4">3</td><td class="ctr1" id="h4">0</td><td class="ctr2" id="i4">8</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr><tr><td id="a1"><a href="JaroWrinklerDistance.java.html#L104" class="el_method">commonPrefixLength(CharSequence, CharSequence)</a></td><td class="bar" id="b5"><img src="../.resources/greenbar.gif" width="24" height="10" title="22" alt="22"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d6"><img src="../.resources/greenbar.gif" width="8" height="10" title
="2" alt="2"/></td><td class="ctr2" id="e2">100%</td><td class="ctr1" id="f5">0</td><td class="ctr2" id="g6">2</td><td class="ctr1" id="h5">0</td><td class="ctr2" id="i6">3</td><td class="ctr1" id="j5">0</td><td class="ctr2" id="k5">1</td></tr><tr><td id="a7"><a href="JaroWrinklerDistance.java.html#L232" class="el_method">transpositions(CharSequence, CharSequence)</a></td><td class="bar" id="b6"><img src="../.resources/greenbar.gif" width="24" height="10" title="22" alt="22"/></td><td class="ctr2" id="c3">100%</td><td class="bar" id="d5"><img src="../.resources/greenbar.gif" width="17" height="10" title="4" alt="4"/></td><td class="ctr2" id="e3">100%</td><td class="ctr1" id="f6">0</td><td class="ctr2" id="g5">3</td><td class="ctr1" id="h6">0</td><td class="ctr2" id="i5">5</td><td class="ctr1" id="j6">0</td><td class="ctr2" id="k6">1</td></tr><tr><td id="a5"><a href="JaroWrinklerDistance.java.html#L40" class="el_method">JaroWrinklerDistance()</a></td><td class="bar" id="b7"><img src=
"../.resources/greenbar.gif" width="3" height="10" title="3" alt="3"/></td><td class="ctr2" id="c4">100%</td><td class="bar" id="d7"/><td class="ctr2" id="e7">n/a</td><td class="ctr1" id="f7">0</td><td class="ctr2" id="g7">1</td><td class="ctr1" id="h7">0</td><td class="ctr2" id="i7">1</td><td class="ctr1" id="j7">0</td><td class="ctr2" id="k7">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.eclemma.org/jacoco">JaCoCo</a> 0.7.2.201409121644</span></div></body></html>
\ No newline at end of file