diff options
author | Rocky Madden <git@rockymadden.com> | 2014-03-26 17:00:29 -0600 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2014-03-26 17:00:29 -0600 |
commit | e085c35c36d3709a9f35c5bbf3b5f6007fae8a18 (patch) | |
tree | e38d64e661bf39e00fab286dd51335ef19ac1178 | |
parent | e952081f2cfa013fb0338602021f6160e49bb708 (diff) | |
download | stringmetric-e085c35c36d3709a9f35c5bbf3b5f6007fae8a18.tar.gz stringmetric-e085c35c36d3709a9f35c5bbf3b5f6007fae8a18.tar.bz2 stringmetric-e085c35c36d3709a9f35c5bbf3b5f6007fae8a18.zip |
Updated references.
-rwxr-xr-x | readme.md | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -264,7 +264,7 @@ It is possible to decorate algorithms and metrics with additional functionality, * __[withMemoization](https://en.wikipedia.org/wiki/Memoization):__ Computations and comparisons are cached. Future calls made with identical arguments will be looked up, rather than computed. -* __withTransform:__ Transform arguments prior to computation/comparison. A handful of pre-built transforms are located in the [transform module](https://github.com/rockymadden/stringmetric/blob/master/core/src/main/scala/com/rockymadden/stringmetric/Transform.scala). +* __withTransform:__ Transform arguments prior to computation/comparison. A handful of pre-built transforms are located in the [transform module](https://github.com/rockymadden/stringmetric/blob/master/core/src/main/scala/com/rockymadden/stringmetric/transform.scala). --- @@ -276,17 +276,24 @@ MetaphoneMetric.compare("abcdef", "abcxyz") --- +Using memoization: +```scala +(MetaphoneAlgorithm withMemoization).compute("abcdef") +``` + +--- + Using a transform so that we only examine alphabetical characters: ```scala -(MetaphoneAlgorithm withTransform StringTransform.filterAlpha).compute("abcdef") -(MetaphoneMetric withTransform StringTransform.filterAlpha).compare("abcdef", "abcxyz") +(MetaphoneAlgorithm withTransform filterAlpha).compute("abcdef") +(MetaphoneMetric withTransform filterAlpha).compare("abcdef", "abcxyz") ``` --- Using a functionally composed transform so that we only examine alphabetical characters, but the case will not matter: ```scala -val composedTransform = (StringTransform.filterAlpha andThen StringTransform.ignoreAlphaCase) +val composedTransform = (filterAlpha andThen ignoreAlphaCase) (MetaphoneAlgorithm withTransform composedTransform).compute("abcdef") (MetaphoneMetric withTransform composedTransform).compare("abcdef", "abcxyz") @@ -304,16 +311,9 @@ val myTransform: StringTransform = (ca) => ca.filter(_ == 'x') --- -Using memoization: -```scala -(MetaphoneAlgorithm withMemoization).compute("abcdef") -``` - ---- - Using memoization and a transform: ```scala -((MetaphoneAlgorithm withMemoization) withTransform StringTransform.filterAlpha).compute("abcdef") +((MetaphoneAlgorithm withMemoization) withTransform filterAlpha).compute("abcdef") ``` --- |