* fix substring word boundaries issue

This commit is contained in:
Reinhard Pointner 2014-09-11 18:18:22 +00:00
parent 0cff9d3ce5
commit dccd755a6e
1 changed files with 3 additions and 3 deletions

View File

@ -34,11 +34,11 @@ public class SubstringMetric implements SimilarityMetric {
if (index < 0)
return false;
// check before and after and make sure we're only matching between word boundries
if (index - 1 >= 0 && !Character.isLetterOrDigit(s1.charAt(index - 1)))
// check before and after and make sure we're only matching between word boundaries
if (index - 1 >= 0 && Character.isLetterOrDigit(s1.charAt(index - 1)))
return false;
if (index + s2.length() < s1.length() && !Character.isLetterOrDigit(index + s2.length()))
if (index + s2.length() < s1.length() && Character.isLetterOrDigit(s1.charAt(index + s2.length())))
return false;
return true;