summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2013-01-23 14:00:35 -0700
committerRocky Madden <git@rockymadden.com>2013-01-23 14:00:35 -0700
commit1937cece0cd002580d1934314262f1177e554cc6 (patch)
tree61f90476cc20453aa58dc31f71a45824d91c84f8
parent03cf93ad70fe3857cbb4f20941f709318f11e9ff (diff)
downloadstringmetric-1937cece0cd002580d1934314262f1177e554cc6.tar.gz
stringmetric-1937cece0cd002580d1934314262f1177e554cc6.tar.bz2
stringmetric-1937cece0cd002580d1934314262f1177e554cc6.zip
Added N-Gram algorithm examples.
-rwxr-xr-xreadme.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/readme.md b/readme.md
index 4dd55a3..f4736d8 100755
--- a/readme.md
+++ b/readme.md
@@ -97,6 +97,20 @@ Output:
0.5
```
+__N-Gram Algorithm:__ _(Note you must specify the size of the n-gram you wish to use)_
+```scala
+println(NGramAlgorithm.compute("abcdefghijklmnopqrstuvwxyz")(1))
+println(NGramAlgorithm.compute("abcdefghijklmnopqrstuvwxyz")(2))
+println(NGramAlgorithm.compute("abcdefghijklmnopqrstuvwxyz")(3))
+```
+
+Output:
+```shell
+Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
+Array("ab", "bc", "cd", "de", "ef", "fg", "gh", "hi", "ij", "jk", "kl", "lm", "mn", "no", "op", "pq", "qr", "rs", "st", "tu", "uv", "vw", "wx", "xy", "yz")
+Array("abc", "bcd", "cde", "def", "efg", "fgh", "ghi", "hij", "ijk", "jkl", "klm", "lmn", "mno", "nop", "opq", "pqr", "qrs", "rst", "stu", "tuv", "uvw", "vwx", "wxy", "xyz")
+```
+
## Testing
```shell
$ gradle :stringmetric-core:test