summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2012-10-15 21:56:10 -0600
committerRocky Madden <git@rockymadden.com>2012-10-15 21:56:10 -0600
commit34f6700bbf63482843831a5a3812f1719c8c4e1f (patch)
tree9c902ede2e08656e3a2bfeb09782eb268eb010c7 /core
parent0db51ce1fe68371efb9010810ce93d93f48c50d0 (diff)
downloadstringmetric-34f6700bbf63482843831a5a3812f1719c8c4e1f.tar.gz
stringmetric-34f6700bbf63482843831a5a3812f1719c8c4e1f.tar.bz2
stringmetric-34f6700bbf63482843831a5a3812f1719c8c4e1f.zip
Fixed bug where stringCleaner was not being used.
Diffstat (limited to 'core')
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/SoundexMetric.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/source/core/scala/org/hashtree/stringmetric/SoundexMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/SoundexMetric.scala
index 358a57f..3d19f5b 100755
--- a/core/source/core/scala/org/hashtree/stringmetric/SoundexMetric.scala
+++ b/core/source/core/scala/org/hashtree/stringmetric/SoundexMetric.scala
@@ -5,14 +5,16 @@ import scala.annotation.tailrec
/** An implementation of the Soundex [[org.hashtree.stringmetric.StringMetric]]. */
object SoundexMetric extends StringMetric {
override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Boolean] = {
- val se1 = if (charArray1.length > 0) soundex(charArray1) else None
- val se2 = if (charArray2.length > 0) soundex(charArray2) else None
+ val se1 = if (charArray1.length > 0) soundex(stringCleaner.clean(charArray1)) else None
+ val se2 = if (charArray2.length > 0) soundex(stringCleaner.clean(charArray2)) else None
if (!se1.isDefined || !se2.isDefined) None else Some(se1.get == se2.get)
}
override def compare(string1: String, string2: String)(implicit stringCleaner: StringCleaner): Option[Boolean] = {
- compare(string1.toCharArray, string2.toCharArray)
+ compare(stringCleaner.clean(string1.toCharArray),
+ stringCleaner.clean(string2.toCharArray)
+ )(new StringCleanerDelegate)
}
private[this] def soundex(ca: Array[Char]) = {