textdistance.rs, Rust crate with 25+ algorithms for comparing strings. Now with no_std support! (github.com)
from orsinium@lemmy.ml to rust@programming.dev on 11 Sep 2024 06:43
https://lemmy.ml/post/20171762

#rust

threaded - newest

abbadon420@lemm.ee on 11 Sep 2024 07:53 next collapse

I like being std free

Deebster@programming.dev on 11 Sep 2024 11:42 collapse

Token-based string distances looks like exactly what I need for my current side project - I’m using Levenshtein but I should be comparing based on words, not characters.

I just need to figure out which (if any) of these does what I need.

Edit: looks like the Python version has that information: github.com/life4/textdistance?tab=readme-ov-file#…

orsinium@lemmy.ml on 12 Sep 2024 06:47 collapse

In Python version, pass the list of words directly into the algorithm, and it will compare words. In Rust version, use Algorithm.for_words:

docs.rs/textdistance/…/trait.Algorithm.html#metho…