Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 2.52 KB

README.md

File metadata and controls

40 lines (30 loc) · 2.52 KB

osita

build codecov Current Version Scala Steward badge license

Osita is an implementation of the Optimal String Alignment distance algorithm. It implements the standard version of the algorithm and an extension of it where the substitution cost has been replaced by a function which calculates the keyboard distance between characters using the Euclidean distance between keys on a QWERTY or AZERTY-keyboard. You can also supply your own substitution cost function.

Installation

Osita is published for Scala 2.12 and 2.13. To start using it add the following to your build.sbt:

libraryDependencies += "nl.gn0s1s" %% "osita" % "0.0.3"

Example usage

import nl.gn0s1s.osita.Osita._

osa("abcde", "abcde") // val res0: Double = 0.0
osa("abcde", "abcd") // val res1: Double = 1.0
osaWithSubstitutionCost("abc", "agc")(qwertySubstitutionCost) // val res2: Double = 1.118033988749895

Resources

License

The code is available under the Mozilla Public License, version 2.0.