All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.halfmatthalfcat.stringmetric.cli.phonetic.nysiismetric.scala Maven / Gradle / Ivy

package com.github.halfmatthalfcat.stringmetric.cli.phonetic

import com.github.halfmatthalfcat.stringmetric.cli._
import com.github.halfmatthalfcat.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")
	}
) { override def main(args: Array[String]): Unit = super.main(args) }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy