blob: 7857c21d4059a21e138560e8d19621bde5af3761 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package com.rockymadden.stringmetric.cli.phonetic
import com.rockymadden.stringmetric.cli._
import com.rockymadden.stringmetric.phonetic.NysiisMetric
case object nysiismetric extends Command(
(opts) =>
"Compares two strings to determine if they are phonetically similarly, per the NYSIIS algorithm." + Ls + Ls +
"Syntax:" + Ls +
Tab + "nysiismetric [Options] string1 string2..." + Ls + Ls +
"Options:" + Ls +
Tab + "-h, --help" + Ls +
Tab + Tab + "Outputs description, syntax, and opts.",
(opts) => opts.contains('dashless) && (opts('dashless): Array[String]).length == 2,
(opts) => {
val strings: Array[String] = opts('dashless)
NysiisMetric.compare(strings(0), strings(1))
.map(_.toString)
.getOrElse("not comparable")
}
)
|