diff options
-rwxr-xr-x | readme.md | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -20,9 +20,15 @@ gradle tar `// Import metric of choice.` `import org.hashtree.stringmetric.similarity.JaroWinklerMetric` +`// Optionally import filters, which clean up arguments prior to evaluation.` +`import org.hashtree.stringmetric.{ AsciiCaseStringFilter, AsciiLetterOnlyStringFilter, StringFilterDelegate }` + `// Invoke metric compare method.` `val distance = JaroWinklerMetric.compare("string1", "string2")` +`// Optionally invoke metric compare method with filters. In this case, non-letter characters and case do not matter.` +`val filteredDistance = JaroWinklerMetric.compare("string1", "string2")(new StringFilterDelegate with AsciiCaseStringFilter with AsciiLetterOnlyStringFilter)` + `// Do something. In this case, distance is between 1.0 and 0.0.` `if (distance >= 0.9) println("It's likely you're a match!")` |