yuujinchou icon indicating copy to clipboard operation
yuujinchou copied to clipboard

🔍 Provide the API to easily support "did you mean...?"

Open favonia opened this issue 2 years ago • 4 comments

Eventually we might want to implement fuzzy search or an API to facilitate the computation of edit distances.

favonia avatar Oct 26 '23 21:10 favonia

I am interested in working on this. For my purposes, the API I need would just be a single function that takes a string and a trie, and returns a list of paths, sorted by distance to the input. What do you have in mind?

Reference edit distance implementations:

  • https://github.com/ifazk/mula/
  • https://github.com/c-cube/spelll/

kentookura avatar Oct 20 '24 14:10 kentookura

@kentookura Yes, that's correct. Alternatively, it can take a list of strings (as a hierarchical name) and a trie. Either way it works!

favonia avatar Oct 20 '24 19:10 favonia

It seems that the standard library will soon contain an edit distance function:

https://github.com/ocaml/ocaml/pull/13760

kentookura avatar Feb 11 '25 08:02 kentookura

@kentookura Wow this is great news!

favonia avatar Feb 12 '25 19:02 favonia