jeancroy / FuzzySearch

:mag: Fast autocomplete suggestion engine using approximate string matching
MIT License
194 stars 32 forks source link

synonyms substitute #25

Closed amodaugustin closed 3 years ago

amodaugustin commented 4 years ago

Hello Team,

Quick question, do we have a synonym substitute that we could do for example `'lat' -> 'Geo Coordinates``

--Thanks B

jeancroy commented 4 years ago

The way I usually handle this in my own projects is that entries can have a item.keywords attribute, which is an array of strings of different ways to call this entry in order of preference.

Then if you want to explain the match there's a GUI helper to find which of the keywords produced a match and communicate a highlight of that to the user. I think I have one example setup like this.

An alternative design is to first use the above method to search a synonym bank, then augment original query with the result of this synonym search. You can then proceed to search original entries with the augmented query.

You may need to toy around if you use the whole query to do synonym search, or first split into words. Then there's some decision weather you keep original word (I think it's best to) Then there's some decision in how strict the match need to be in the synonym search.

Jean Christophe Roy