commonMain.com.darkrockstudios.symspellkt.impl.DataLoadUtils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SymSpellKt-jvm Show documentation
Show all versions of SymSpellKt-jvm Show documentation
A Kotlin Multiplatform implementation of the SymSpell Spell Checking algorithm.
package com.darkrockstudios.symspellkt.impl
import com.darkrockstudios.symspellkt.api.DictionaryHolder
import com.darkrockstudios.symspellkt.common.DictionaryItem
private val splitRegex = "\\s+".toRegex()
fun DictionaryHolder.loadUniGramLine(line: String) {
val arr = line.split(splitRegex)
if (arr.size > 1) {
addItem(DictionaryItem(arr[0], arr[1].toDouble(), -1.0))
}
}
fun DictionaryHolder.loadBiGramLine(line: String) {
val arr = line.split(splitRegex)
if (arr.size > 2) {
addItem(DictionaryItem(arr[0] + " " + arr[1], arr[2].toDouble(), -1.0))
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy