diff options
author | Rocky Madden <git@rockymadden.com> | 2013-01-23 14:00:35 -0700 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2013-01-23 14:00:35 -0700 |
commit | 1937cece0cd002580d1934314262f1177e554cc6 (patch) | |
tree | 61f90476cc20453aa58dc31f71a45824d91c84f8 | |
parent | 03cf93ad70fe3857cbb4f20941f709318f11e9ff (diff) | |
download | stringmetric-1937cece0cd002580d1934314262f1177e554cc6.tar.gz stringmetric-1937cece0cd002580d1934314262f1177e554cc6.tar.bz2 stringmetric-1937cece0cd002580d1934314262f1177e554cc6.zip |
Added N-Gram algorithm examples.
-rwxr-xr-x | readme.md | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |