diff options
author | Rocky Madden <git@rockymadden.com> | 2012-11-02 07:30:15 -0600 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2012-11-02 07:30:15 -0600 |
commit | 4cb9c4b4b1200dc85606b659293f72668e4bd244 (patch) | |
tree | 27f4f547e2604038d24c96d34432e9003d3e3a4e /readme.md | |
parent | fa49cfad6cac561be16c566afe694a30054fd7ca (diff) | |
download | stringmetric-4cb9c4b4b1200dc85606b659293f72668e4bd244.tar.gz stringmetric-4cb9c4b4b1200dc85606b659293f72668e4bd244.tar.bz2 stringmetric-4cb9c4b4b1200dc85606b659293f72668e4bd244.zip |
Added github flavored markdown.
Diffstat (limited to 'readme.md')
-rwxr-xr-x | readme.md | 107 |
1 files changed, 58 insertions, 49 deletions
@@ -61,73 +61,82 @@ Filters, which can optionally be applied, clean up arguments prior to evaluation ## Versioning [Semantic Versioning 2.0.0](http://semver.org/) -## Building the API - gradle :stringmetric-core:jar +## Building +Build the API. +```shell +gradle :stringmetric-core:jar +``` -## Building the CLI - gradle :stringmetric-cli:tar +Build the CLI. +```shell +gradle :stringmetric-cli:tar +``` ## Using the API - // Simple example. Import metric, compare, do something with result. - import org.hashtree.stringmetric.similarity.JaroWinklerMetric +Simple example. Import metric, compare, do something with result. +```scala +import org.hashtree.stringmetric.similarity.JaroWinklerMetric - val distance = JaroWinklerMetric.compare("string1", "string2") +val distance = JaroWinklerMetric.compare("string1", "string2") - if (distance >= 0.9) println("It's likely you're a match!") +if (distance >= 0.9) println("It's likely you're a match!") +``` -***** +One filter example. Import metric, compare with one filter, do something with result. +```scala +import org.hashtree.stringmetric.similarity.{ JaroWinklerMetric, StringFilterDelegate } +import org.hashtree.stringmetric.filter.AsciiLetterCaseStringFilter - // One filter example. Import metric, compare with one filter, do something with result. - import org.hashtree.stringmetric.similarity.{ JaroWinklerMetric, StringFilterDelegate } - import org.hashtree.stringmetric.filter.AsciiLetterCaseStringFilter +val distance = JaroWinklerMetric.compare("string1", "string2") + (new StringFilterDelegate with AsciiLetterCaseStringFilter) - val distance = JaroWinklerMetric.compare("string1", "string2") - (new StringFilterDelegate with AsciiLetterCaseStringFilter) +if (distance >= 0.9) println("It's likely you're a match!") +``` - if (distance >= 0.9) println("It's likely you're a match!") +Compound filter example. Import metric, compare with two filters, do something with result. Filters are applied in reverse order! +```scala +import org.hashtree.stringmetric.similarity.{ JaroWinklerMetric, StringFilterDelegate } +import org.hashtree.stringmetric.filter.{ AsciiLetterCaseStringFilter, AsciiLetterOnlyStringFilter } -***** +val distance = JaroWinklerMetric.compare("string1", "string2") + (new StringFilterDelegate with AsciiLetterCaseStringFilter with AsciiLetterOnlyStringFilter) - // Compound filter example. Import metric, compare with two filters, do something with result. Filters are applied in reverse order! - import org.hashtree.stringmetric.similarity.{ JaroWinklerMetric, StringFilterDelegate } - import org.hashtree.stringmetric.filter.{ AsciiLetterCaseStringFilter, AsciiLetterOnlyStringFilter } +if (distance >= 0.9) println("It's likely you're a match!")` +``` - val distance = JaroWinklerMetric.compare("string1", "string2") - (new StringFilterDelegate with AsciiLetterCaseStringFilter with AsciiLetterOnlyStringFilter) - - if (distance >= 0.9) println("It's likely you're a match!")` - -***** - - // All string metrics and algorithms have overloaded methods which accept character arrays. - import org.hashtree.stringmetric.similarity.JaroWinklerMetric +All string metrics and algorithms have overloaded methods which accept character arrays. +```scala +import org.hashtree.stringmetric.similarity.JaroWinklerMetric - val distance = JaroWinklerMetric.compare("string1".toCharArray, "string2".toCharArray) +val distance = JaroWinklerMetric.compare("string1".toCharArray, "string2".toCharArray) - if (distance >= 0.9) println("It's likely you're a match!") +if (distance >= 0.9) println("It's likely you're a match!") +``` ## Using the CLI Uncompress the built tar and ensure you have ability to execute the commands. Execute the metric of choice via the command line: - // The help option prints command syntax and usage. - jaroWinklerMetric --help - metaphoneMetric --help - metaphoneAlgorithm --help - -***** - - // Compare "abc" to "xyz" using the Jaro-Winkler metric. - jaroWinklerMetric abc xyz` - -***** - - // Compare "abc "to "xyz" using the Metaphone metric. - metaphoneMetric abc xyz - -***** - - // Get the phonetic representation of "abc" via the metaphone phonetic algorithm. - metaphoneAlgorithm abc +The help option prints command syntax and usage. +```shell +jaroWinklerMetric --help +metaphoneMetric --help +metaphoneAlgorithm --help +``` + +Compare "abc" to "xyz" using the Jaro-Winkler metric. +```shell +jaroWinklerMetric abc xyz` +``` + +Compare "abc "to "xyz" using the Metaphone metric. +```shell +metaphoneMetric abc xyz +``` + +Get the phonetic representation of "abc" via the metaphone phonetic algorithm. +```shell +metaphoneAlgorithm abc +``` ## Requirements * Scala 2.9.2 |