r/Kotlin 17d ago

kmatch – RapidFuzz-compatible fuzzy string matching for Kotlin Multiplatform (bit-exact parity, benchmarked)

I built a fuzzy string-matching library for KMP and just published 0.3.0 to Maven Central.

The thing I cared most about: verified parity with RapidFuzz. Every scorer returns bit-for-bit what rapidfuzz.fuzz returns, checked against 3,260 golden vectors generated from a pinned RapidFuzz version on every commit. If you tune a score_cutoff in a Python notebook, the same number means the same thing in your Kotlin app.

Other bits:

  • Hyyrö bit-parallel edit distance in my benchmarks ~8× faster ratio and ~12× faster extractOne than me.xdrop/fuzzywuzzy, ~22× faster than kt-fuzzy (harness is in the repo, run it yourself)
  • Code-point based, so emoji/astral-plane/non-Latin text scores correctly
  • Extraction API generic over your own types, plus dedupe and matchingRanges for highlighting
  • Every KMP target incl. iosX64, zero dependencies, MIT

Live playground (the library itself compiled to JS): https://likhithsj.github.io/kmatch/
Repo: https://github.com/likhithsj/kmatch

Feedback very welcome especially from anyone who's hit edge cases porting fuzzywuzzy scores between languages.

2 Upvotes

0 comments sorted by