diff options
16 files changed, 34 insertions, 30 deletions
diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala index 9428bc2..d0e121a 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/hammingMetric.scala @@ -1,8 +1,9 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ CaseStringCleaner, HammingMetric, StringCleanerDelegate } +import org.hashtree.stringmetric.{ CaseStringCleaner, StringCleanerDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.distance.HammingMetric /** * The hammingMetric [[org.hashtree.stringmetric.cli.command.Command]]. Compares the number of characters that two equal diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala index 922e285..86abdd5 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala @@ -1,8 +1,9 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ CaseStringCleaner, JaroMetric, StringCleanerDelegate } +import org.hashtree.stringmetric.{ CaseStringCleaner, StringCleanerDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.distance.JaroMetric /** * The jaroMetric [[org.hashtree.stringmetric.cli.command.Command]]. Compares two strings to calculate the diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala index 6509cc4..564024d 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala @@ -1,8 +1,9 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ CaseStringCleaner, JaroWinklerMetric, StringCleanerDelegate } +import org.hashtree.stringmetric.{ CaseStringCleaner, StringCleanerDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.distance.JaroWinklerMetric /** * The jaroWinklerMetric [[org.hashtree.stringmetric.cli.command.Command]]. Compares two strings to calculate the diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala index 59a73e8..3c7682a 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/levenshteinMetric.scala @@ -1,8 +1,9 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ CaseStringCleaner, LevenshteinMetric, StringCleanerDelegate } +import org.hashtree.stringmetric.{ CaseStringCleaner, StringCleanerDelegate } import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.distance.LevenshteinMetric /** * The levenshteinMetric [[org.hashtree.stringmetric.cli.command.Command]]. Compares the number of characters that two diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala index cb119c2..adefd14 100755 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexMetric.scala @@ -1,8 +1,9 @@ package org.hashtree.stringmetric.cli.command -import org.hashtree.stringmetric.{ SoundexMetric, StringCleanerDelegate } +import org.hashtree.stringmetric.StringCleanerDelegate import org.hashtree.stringmetric.cli._ import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.phonetic.SoundexMetric /** * The soundexMetric [[org.hashtree.stringmetric.cli.command.Command]]. Compares two strings to determine if they are diff --git a/core/source/core/scala/org/hashtree/stringmetric/HammingMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/distance/HammingMetric.scala index 0a7ebd3..f8fe982 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/HammingMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/distance/HammingMetric.scala @@ -1,9 +1,9 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance + +import org.hashtree.stringmetric.{ CompareTuple, StringCleaner, StringCleanerDelegate, StringMetric } /** An implementation of the Hamming [[org.hashtree.stringmetric.StringMetric]]. */ object HammingMetric extends StringMetric { - implicit val stringCleaner = new StringCleanerDelegate with CaseStringCleaner - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Int] = { val ca1 = stringCleaner.clean(charArray1) val ca2 = stringCleaner.clean(charArray2) diff --git a/core/source/core/scala/org/hashtree/stringmetric/JaroMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/distance/JaroMetric.scala index 7af4933..6309bc5 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/JaroMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/distance/JaroMetric.scala @@ -1,7 +1,7 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance +import org.hashtree.stringmetric.{ CompareTuple, MatchTuple, StringCleaner, StringCleanerDelegate, StringMetric } import scala.collection.mutable.{ ArrayBuffer, HashSet } -import scala.math /** * An implementation of the Jaro [[org.hashtree.stringmetric.StringMetric]]. One differing detail in this implementation @@ -9,8 +9,6 @@ import scala.math * distance in these scenarios. */ object JaroMetric extends StringMetric { - implicit val stringCleaner = new StringCleanerDelegate with CaseStringCleaner with SpaceStringCleaner - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Float] = { val ca1 = stringCleaner.clean(charArray1) val ca2 = stringCleaner.clean(charArray2) diff --git a/core/source/core/scala/org/hashtree/stringmetric/JaroWinklerMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/distance/JaroWinklerMetric.scala index 85a0736..568a69e 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/JaroWinklerMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/distance/JaroWinklerMetric.scala @@ -1,4 +1,6 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance + +import org.hashtree.stringmetric.{ StringCleaner, StringCleanerDelegate, StringMetric } /** * An implementation of the Jaro-Winkler [[org.hashtree.stringmetric.StringMetric]]. One differing detail in this @@ -6,8 +8,6 @@ package org.hashtree.stringmetric * penalized distance in these scenarios (e.g. comparing henka and henkan distance is 0.9666 versus the typical 0.9722). */ object JaroWinklerMetric extends StringMetric { - implicit val stringCleaner = new StringCleanerDelegate with CaseStringCleaner with SpaceStringCleaner - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Float] = { val ca1 = stringCleaner.clean(charArray1) val ca2 = stringCleaner.clean(charArray2) diff --git a/core/source/core/scala/org/hashtree/stringmetric/LevenshteinMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/distance/LevenshteinMetric.scala index 9465c66..9925b57 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/LevenshteinMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/distance/LevenshteinMetric.scala @@ -1,11 +1,9 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance -import scala.math +import org.hashtree.stringmetric.{ CompareTuple, StringCleaner, StringCleanerDelegate, StringMetric } /** An implementation of the Levenshtein [[org.hashtree.stringmetric.StringMetric]]. */ object LevenshteinMetric extends StringMetric { - implicit val stringCleaner = new StringCleanerDelegate with CaseStringCleaner - override def compare(charArray1: Array[Char], charArray2: Array[Char])(implicit stringCleaner: StringCleaner): Option[Int] = { val ca1 = stringCleaner.clean(charArray1) val ca2 = stringCleaner.clean(charArray2) diff --git a/core/source/core/scala/org/hashtree/stringmetric/package.scala b/core/source/core/scala/org/hashtree/stringmetric/package.scala index 3be74fb..89bfee4 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/package.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/package.scala @@ -5,4 +5,6 @@ package object stringmetric { type CompareTuple = Tuple2[Array[Char], Array[Char]] type MatchTuple = CompareTuple + + implicit val stringCleaner = new StringCleanerDelegate }
\ No newline at end of file diff --git a/core/source/core/scala/org/hashtree/stringmetric/SoundexMetric.scala b/core/source/core/scala/org/hashtree/stringmetric/phonetic/SoundexMetric.scala index 3c3ee5b..c8f2d13 100755 --- a/core/source/core/scala/org/hashtree/stringmetric/SoundexMetric.scala +++ b/core/source/core/scala/org/hashtree/stringmetric/phonetic/SoundexMetric.scala @@ -1,5 +1,6 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.phonetic +import org.hashtree.stringmetric.{ StringCleaner, StringCleanerDelegate, StringMetric } import scala.annotation.tailrec /** An implementation of the Soundex [[org.hashtree.stringmetric.StringMetric]]. */ diff --git a/core/source/test/scala/org/hashtree/stringmetric/HammingMetricSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/distance/HammingMetricSpec.scala index 5fd0e26..21608c2 100755 --- a/core/source/test/scala/org/hashtree/stringmetric/HammingMetricSpec.scala +++ b/core/source/test/scala/org/hashtree/stringmetric/distance/HammingMetricSpec.scala @@ -1,6 +1,6 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance -import org.hashtree.stringmetric.HammingMetric.stringCleaner +import org.hashtree.stringmetric.ScalaTest import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner diff --git a/core/source/test/scala/org/hashtree/stringmetric/JaroMetricSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/distance/JaroMetricSpec.scala index d1682ad..f07a4e9 100755 --- a/core/source/test/scala/org/hashtree/stringmetric/JaroMetricSpec.scala +++ b/core/source/test/scala/org/hashtree/stringmetric/distance/JaroMetricSpec.scala @@ -1,6 +1,6 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance -import org.hashtree.stringmetric.JaroMetric.stringCleaner +import org.hashtree.stringmetric.ScalaTest import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner diff --git a/core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/distance/JaroWinklerMetricSpec.scala index 550a188..0e52b4f 100755 --- a/core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala +++ b/core/source/test/scala/org/hashtree/stringmetric/distance/JaroWinklerMetricSpec.scala @@ -1,6 +1,6 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance -import org.hashtree.stringmetric.JaroWinklerMetric.stringCleaner +import org.hashtree.stringmetric.ScalaTest import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner diff --git a/core/source/test/scala/org/hashtree/stringmetric/LevenshteinMetricSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/distance/LevenshteinMetricSpec.scala index 01c9082..07e3a94 100755 --- a/core/source/test/scala/org/hashtree/stringmetric/LevenshteinMetricSpec.scala +++ b/core/source/test/scala/org/hashtree/stringmetric/distance/LevenshteinMetricSpec.scala @@ -1,6 +1,6 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.distance -import org.hashtree.stringmetric.LevenshteinMetric.stringCleaner +import org.hashtree.stringmetric.ScalaTest import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner diff --git a/core/source/test/scala/org/hashtree/stringmetric/SoundexMetricSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/phonetic/SoundexMetricSpec.scala index 8530d92..6664696 100755 --- a/core/source/test/scala/org/hashtree/stringmetric/SoundexMetricSpec.scala +++ b/core/source/test/scala/org/hashtree/stringmetric/phonetic/SoundexMetricSpec.scala @@ -1,6 +1,6 @@ -package org.hashtree.stringmetric +package org.hashtree.stringmetric.phonetic -import org.hashtree.stringmetric.SoundexMetric.stringCleaner +import org.hashtree.stringmetric.ScalaTest import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner |