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

com.rockymadden.stringmetric.cli.similarity.jarowinklermetric.scala Maven / Gradle / Ivy

The newest version!
package com.rockymadden.stringmetric.cli.similarity

import com.rockymadden.stringmetric.cli._
import com.rockymadden.stringmetric.similarity.JaroWinklerMetric

case object jarowinklermetric extends Command(
	(opts) =>
		"Compares two strings to calculate the Jaro-Winkler distance." + Ls + Ls +
		"Syntax:" + Ls +
		Tab + "jarowinklermetric [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)

		JaroWinklerMetric.compare(strings(0), strings(1))
			.map(_.toString)
			.getOrElse("not comparable")
	}
)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy