Closed dwyzlic-ias closed 1 year ago
If you want something like this, I would suggest tokenizing the inputs. Fast fuzzy is a lower-level library that excels at matching individual words, the original use case for this library was for use in autocomplete/autocorrect systems. However, it is possible to extend this functionality into something higher level, like this example (or for searching across entire documents).
One can use the keySelector
option to take the search term "hello world"
and return an array of tokens ["hello", "world"]
.
This will make the value match on either word. Then you can further divide the search term "world hello"
into ["world", "hello"]
, run a search on each token, and combine the results to determine best match.
shameless plug for a lib that does this out-of-order matching quite well ;)
Hi!
Today if I have:
The algorithm doesn't work when words are not in the good order, is there any way to fix that?