Walter Oggioni 0d5629f298
Some checks failed
CI / build (push) Failing after 18s
removed double publication
2024-03-24 18:41:28 +08:00
2024-03-24 18:36:28 +08:00
2023-05-25 08:14:11 +08:00
2023-05-29 20:23:01 +08:00
2022-06-24 07:56:23 +08:00
2022-06-24 07:56:23 +08:00
2024-03-24 18:41:28 +08:00
2023-03-04 19:16:35 +08:00
2023-05-21 23:06:37 +08:00
2023-05-25 08:59:51 +08:00
2023-03-04 19:14:31 +08:00

Kotlin multiplatform library for Levenshtein distance

THis library is used to find the closest matches of a word in a predefined set of word, according to Levenshtein distance or Damerau-Levenshtein distance.

Build

The library uses Gradle as the build system, so the only required dependency is a valid JDK 17 implementation. Then it can be built using

./gradlew build

Usage

The library is avaliable from "https://woggioni.net/mvn" Maven repository and can ba consumed by another Gradle project simply by adding

repositories {
    maven {
        url = "https://woggioni.net/mvn"
    }
}
dependencies {
    implementation group: 'net.woggioni', name: 'klevtree', version: '2023.03'
}

As a Kotlin multiplatform library it currently supports the jvm, js and linuxX64 targets

Example code

val words = listOf(
    "tired",
    "authorise",
    "exercise",
    "bloody",
    "ritual",
    "trail",
    "resort",
    "landowner",
    "navy",
    "captivate",
    "captivity",
    "north")
val tree = LevTrie().apply {
    algorithm = LevTrie.Algorithm.DAMERAU_LEVENSHTEIN
    caseSensitive = false
    words.forEach(this::add)
}
val result = tree.fuzzySearch("fired", 1)
result.forEach {
    println("Word: ${it.first}, distance: ${it.second}")
}

// Word: tired, distance: 1

Description
No description provided
Readme 410 KiB
Languages
Kotlin 99.6%
Java 0.4%