A Kotlin Multiplatform implementation of the SymSpell algorithm.
This is a Kotlin Multiplatform implementation of the symspell fuzzy search algorithm. It has been ported from this Java implementation of symspell.
implementation("com.darkrockstudios:symspellkt:1.1.0")
Try out the sample desktop application:
gradlew sampleCompose:run
There are 2 implementations of the keyboards one is English Qwerty based and other is German Qwertz based implementation we used the adjancey graph of the keyboard for the weights to the connected nodes.
Spellcorrection Strategy | Accuracy | Failures | TP | TN | FP | FN |
---|---|---|---|---|---|---|
LUCENE | 78.96% | 21.04% | 5883 | 481 | 146 | 1550 |
Vanilla SymSpell | 88.80% | 11.20% | 6888 | 269 | 358 | 545 |
Weighted SymSpell | 75.74% | 24.26% | 5781 | 324 | 303 | 1652 |
Qwerty Vanilla SymSpell | 88.57% | 11.43% | 6860 | 279 | 348 | 573 |
Qwerty Weighted SymSpell | 75.36% | 24.64% | 5744 | 330 | 297 | 1689 |
For 2 terms:
slices
olives
If the misspelled word is, slives
both slices and olives is 1 edit distance,
so in default case the one with higher frequency will end up in the result.
While with the qwerty based char distance,
slives is more closer to slices.
The reason for this is in Qwerty Based Keyboard,
S and O are too far while V and C are adjacent.
Word deletes are generated with taking edit distance which is minimum of max edit distance and 0.3 * word.length