summaryrefslogtreecommitdiff
path: root/readme.md
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2013-01-23 14:18:47 -0700
committerRocky Madden <git@rockymadden.com>2013-01-23 14:18:47 -0700
commitcd5271bf631656ea556a0bf4707e0eeb0fd275ae (patch)
treeeb0d7737cdfa0febf63fc79f03e9b988cbf16ab1 /readme.md
parent1641306557c9cf0b283dfe39fd2c51bf4c76baba (diff)
downloadstringmetric-cd5271bf631656ea556a0bf4707e0eeb0fd275ae.tar.gz
stringmetric-cd5271bf631656ea556a0bf4707e0eeb0fd275ae.tar.bz2
stringmetric-cd5271bf631656ea556a0bf4707e0eeb0fd275ae.zip
Added Metaphone algorithm examples.
Diffstat (limited to 'readme.md')
-rwxr-xr-xreadme.md32
1 files changed, 22 insertions, 10 deletions
diff --git a/readme.md b/readme.md
index 26eadbd..9649efe 100755
--- a/readme.md
+++ b/readme.md
@@ -26,7 +26,7 @@ println(DiceSorensenMetric.compare("context", "contact"))
```
Output:
-```shell
+```
0.6
0.7142857142857143
```
@@ -38,7 +38,7 @@ println(HammingMetric.compare("1011101", "1001001"))
```
Output: _(Note the exception of integers, rather than doubles, being returned.)_
-```shell
+```
3
2
```
@@ -51,7 +51,7 @@ println(JaroMetric.compare("fvie", "ten"))
```
Output:
-```shell
+```
0.8222222222222223
0.7904761904761904
0
@@ -65,7 +65,7 @@ println(JaroWinklerMetric.compare("fvie", "ten"))
```
Output:
-```shell
+```
0.8400000000000001
0.8323809523809523
0
@@ -78,7 +78,7 @@ println(LevenshteinMetric.compare("cake", "drake"))
```
Output: _(Note the exception of integers, rather than doubles, being returned.)_
-```shell
+```
3
2
```
@@ -91,7 +91,7 @@ println(NGramMetric.compare("context", "contact")(2))
```
Output:
-```shell
+```
0.6
0.25
0.5
@@ -105,7 +105,7 @@ 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")
@@ -118,7 +118,7 @@ println(RatcliffObershelpMetric.compare("pennsylvania", "pencilvaneya"))
```
Output:
-```shell
+```
0.7368421052631579
0.6666666666666666
```
@@ -131,7 +131,7 @@ println(WeightedLevenshteinMetric.compare("hospital", "hosp")(10, 0.1, 1))
```
Output: _(Note that while a double is returned, it can be outside the range of 0 to 1, based upon the weights used.)_
-```shell
+```
2
0.4
40
@@ -147,11 +147,23 @@ println(MetaphoneMetric.compare("dumb", "gum"))
```
Output:
-```shell
+```
true
false
```
+__Metaphone Algorithm:__
+```scala
+println(MetaphoneAlgorithm.compute("dumb"))
+println(MetaphoneAlgorithm.compute("knuth"))
+```
+
+Output:
+```
+tm
+n0
+```
+
## Testing
```shell
$ gradle :stringmetric-core:test