Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🧸 Tiny optimal string alignment distance library

License

NotificationsYou must be signed in to change notification settings

Philippus/osita

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

buildcodecovCurrent VersionScala Steward badgelicense

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

Installation

Osita is published for Scala 2.12, 2.13 and 3. To start using it add the following to yourbuild.sbt:

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

Example usage

importnl.gn0s1s.osita.Osita._osa("abcde","abcde")// val res0: Double = 0.0osa("abcde","abcd")// val res1: Double = 1.0osaWithSubstitutionCost("abc","agc")(qwertySubstitutionCost)// val res2: Double = 1.118033988749895

Resources

License

The code is available under theMozilla Public License, version 2.0.


[8]ページ先頭

©2009-2025 Movatter.jp