-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Weighted distances #3
Comments
Hello! Thanks for filing the issue, and apologies for getting back to you so late. I am definitely open to contributions! Could you possibly elaborate on the use cases you have for weighted distances in this context? Regarding the API itself, I think we can get away without causing any breaking changes. We could move the logic of the algorithm to functions that work with weights, and the existing API could just be wrappers around this that use (1,1,1) as weights. We'd also want to incorporate the weights into the DistanceMatrix (which possibly have to go from a type alias to a struct wrapping the weights). So at first glance, it sounds doable. |
Hi thanks for respoding!
In Python, I often times used Insertion/Deletion weights of 1, and Substitution weights of 2, because I personally found this yields better results when trying to find the best match between a string and a list of other strings. This is baked into the RapidFuzz library I mentioned before as the "Indel distance". As for the implementation, I also thought about just having a struct where you set the weights one time (with a default of (1,1,1)) and then have the functions as methods of that struct, as it is more idiomatic Rust (I think), but I also really like your suggested approach. Not dealing with major breaking changes is probably a very good idea. Edit: I forked the repo and implemented a rough prototype of both approaches in separate branches with breaking changes and without. Let me know what you think! |
Hi there!
Coming from using the RapidFuzz library in Python, a feature I liked to use was weighted distances. RapidFuzz Docs.
Do you think this would be possible to implement here without too much issue? I know parameters might pose a design problem as there are no optional arguments in Rust and having every function always take weights might be annoying to users. Maybe a separate function would be useful? Would you be open to contributions?
Thanks in advance for responding!
The text was updated successfully, but these errors were encountered: