diff options
author | Rocky Madden <git@rockymadden.com> | 2013-01-23 13:57:46 -0700 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2013-01-23 13:57:46 -0700 |
commit | 03cf93ad70fe3857cbb4f20941f709318f11e9ff (patch) | |
tree | 62b7a30ad6db8df0b89f1e1421f24756f1c4b82f /readme.md | |
parent | 64e4d378868e1a2165425a3741ab2cc526e23b31 (diff) | |
download | stringmetric-03cf93ad70fe3857cbb4f20941f709318f11e9ff.tar.gz stringmetric-03cf93ad70fe3857cbb4f20941f709318f11e9ff.tar.bz2 stringmetric-03cf93ad70fe3857cbb4f20941f709318f11e9ff.zip |
Added N-Gram examples.
Diffstat (limited to 'readme.md')
-rwxr-xr-x | readme.md | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -37,7 +37,7 @@ println(HammingMetric.compare("toned", "roses")) println(HammingMetric.compare("1011101", "1001001")) ``` -Output (note the exception of integers, rather than doubles, being returned): +Output: _(Note the exception of integers, rather than doubles, being returned)_ ```shell 3 2 @@ -77,12 +77,26 @@ println(LevenshteinMetric.compare("sitting", "kitten")) println(LevenshteinMetric.compare("cake", "drake")) ``` -Output (note the exception of integers, rather than doubles, being returned): +Output: _(Note the exception of integers, rather than doubles, being returned)_ ```shell 3 2 ``` +__N-Gram Metric:__ _(Note you must specify the size of the n-gram you wish to use)_ +```scala +println(NGramMetric.compare("night", "nacht")(1)) +println(NGramMetric.compare("night", "nacht")(2)) +println(NGramMetric.compare("context", "contact")(2)) +``` + +Output: +```shell +0.6 +0.25 +0.5 +``` + ## Testing ```shell $ gradle :stringmetric-core:test |