summaryrefslogtreecommitdiff
path: root/readme.md
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2013-01-23 13:57:46 -0700
committerRocky Madden <git@rockymadden.com>2013-01-23 13:57:46 -0700
commit03cf93ad70fe3857cbb4f20941f709318f11e9ff (patch)
tree62b7a30ad6db8df0b89f1e1421f24756f1c4b82f /readme.md
parent64e4d378868e1a2165425a3741ab2cc526e23b31 (diff)
downloadstringmetric-03cf93ad70fe3857cbb4f20941f709318f11e9ff.tar.gz
stringmetric-03cf93ad70fe3857cbb4f20941f709318f11e9ff.tar.bz2
stringmetric-03cf93ad70fe3857cbb4f20941f709318f11e9ff.zip
Added N-Gram examples.
Diffstat (limited to 'readme.md')
-rwxr-xr-xreadme.md18
1 files changed, 16 insertions, 2 deletions
diff --git a/readme.md b/readme.md
index c819c60..4dd55a3 100755
--- a/readme.md
+++ b/readme.md
@@ -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