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

commonMain.com.darkrockstudios.symspellkt.impl.DataLoadUtils.kt Maven / Gradle / Ivy

Go to download

A Kotlin Multiplatform implementation of the SymSpell Spell Checking algorithm.

There is a newer version: 3.1.0
Show newest version
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