gram@lemmy.ml to Rust@programming.devEnglish · 2 months agotextdistance.rs, Rust crate with 25+ algorithms for comparing strings. Now with no_std support!github.comexternal-linkmessage-square3fedilinkarrow-up157arrow-down10cross-posted to: rust@programming.dev
arrow-up157arrow-down1external-linktextdistance.rs, Rust crate with 25+ algorithms for comparing strings. Now with no_std support!github.comgram@lemmy.ml to Rust@programming.devEnglish · 2 months agomessage-square3fedilinkcross-posted to: rust@programming.dev
minus-squareDeebster@programming.devlinkfedilinkarrow-up4·edit-22 months agoToken-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: https://github.com/life4/textdistance?tab=readme-ov-file#algorithms
minus-squaregram@lemmy.mlOPlinkfedilinkEnglisharrow-up2·2 months agoIn Python version, pass the list of words directly into the algorithm, and it will compare words. In Rust version, use Algorithm.for_words: https://docs.rs/textdistance/1.1.0/textdistance/trait.Algorithm.html#method.for_words
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: https://github.com/life4/textdistance?tab=readme-ov-file#algorithms
In Python version, pass the list of words directly into the algorithm, and it will compare words. In Rust version, use Algorithm.for_words:
https://docs.rs/textdistance/1.1.0/textdistance/trait.Algorithm.html#method.for_words