summaryrefslogtreecommitdiff
path: root/cli/source
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2012-10-08 22:29:42 -0600
committerRocky Madden <git@rockymadden.com>2012-10-08 22:29:42 -0600
commitf380762362860d432d27d9861d817be393f19da6 (patch)
tree59da9b12cc59452a1b2a774a54f508be36e73d42 /cli/source
parent2b6d745e54ed5a4c9f3253f9c97188861aef4452 (diff)
downloadstringmetric-f380762362860d432d27d9861d817be393f19da6.tar.gz
stringmetric-f380762362860d432d27d9861d817be393f19da6.tar.bz2
stringmetric-f380762362860d432d27d9861d817be393f19da6.zip
Created cleaners to allow implementors to determine the amount of cleaning performed on inputs prior to metric computations, if desired. Applied implicitly to metric compare methods in second curry. Previous behavior of ignoring case and spacing held in tact, while allowing for further definition if needed via arguments.
Diffstat (limited to 'cli/source')
-rwxr-xr-xcli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroMetric.scala4
-rwxr-xr-xcli/source/core/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetric.scala4
-rwxr-xr-xcli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroMetricSpec.scala4
-rwxr-xr-xcli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetricSpec.scala4
4 files changed, 8 insertions, 8 deletions
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 ba061c7..f633322 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,6 +1,6 @@
package org.hashtree.stringmetric.cli.command
-import org.hashtree.stringmetric.JaroMetric
+import org.hashtree.stringmetric.{ CaseStringCleaner, JaroMetric, StringCleanerDelegate }
import org.hashtree.stringmetric.cli._
import org.hashtree.stringmetric.cli.command._
@@ -47,6 +47,6 @@ object jaroMetric extends Command {
override def execute(options: OptionMap): Unit = {
val strings = options('dashless).split(" ")
- println(JaroMetric.compare(strings(0), strings(1)).toString)
+ println(JaroMetric.compare(strings(0), strings(1))(new StringCleanerDelegate with CaseStringCleaner).toString)
}
} \ No newline at end of file
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 63ab69c..8590ac9 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,6 +1,6 @@
package org.hashtree.stringmetric.cli.command
-import org.hashtree.stringmetric.JaroWinklerMetric
+import org.hashtree.stringmetric.{ CaseStringCleaner, JaroWinklerMetric, StringCleanerDelegate }
import org.hashtree.stringmetric.cli._
import org.hashtree.stringmetric.cli.command._
@@ -47,6 +47,6 @@ object jaroWinklerMetric extends Command {
override def execute(options: OptionMap): Unit = {
val strings = options('dashless).split(" ")
- println(JaroWinklerMetric.compare(strings(0), strings(1)).toString)
+ println(JaroWinklerMetric.compare(strings(0), strings(1))(new StringCleanerDelegate with CaseStringCleaner).toString)
}
} \ No newline at end of file
diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroMetricSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroMetricSpec.scala
index d3eabe0..87544e8 100755
--- a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroMetricSpec.scala
+++ b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroMetricSpec.scala
@@ -13,14 +13,14 @@ final class jaroMetricSpec extends ScalaTest {
val out = new java.io.ByteArrayOutputStream()
Console.withOut(out)(
- jaroMetric.main(Array("--unitTest", "--debug", "abc", "abc"))
+ jaroMetric.main(Array("--unitTest", "--debug", "aBc", "abc"))
)
out.toString should equal ("1.0\n")
out.reset()
Console.withOut(out)(
- jaroMetric.main(Array("--unitTest", "--debug", "abc", "xyz"))
+ jaroMetric.main(Array("--unitTest", "--debug", "aBc", "xyz"))
)
out.toString should equal ("0.0\n")
diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetricSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetricSpec.scala
index 071454a..02f9340 100755
--- a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetricSpec.scala
+++ b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/jaroWinklerMetricSpec.scala
@@ -13,14 +13,14 @@ final class jaroWinklerMetricSpec extends ScalaTest {
val out = new java.io.ByteArrayOutputStream()
Console.withOut(out)(
- jaroWinklerMetric.main(Array("--unitTest", "--debug", "abc", "abc"))
+ jaroWinklerMetric.main(Array("--unitTest", "--debug", "aBc", "abc"))
)
out.toString should equal ("1.0\n")
out.reset()
Console.withOut(out)(
- jaroWinklerMetric.main(Array("--unitTest", "--debug", "abc", "xyz"))
+ jaroWinklerMetric.main(Array("--unitTest", "--debug", "aBc", "xyz"))
)
out.toString should equal ("0.0\n")