Search code examples
javascriptdictionarytrie

Trie dictionary lookups


just read http://ejohn.org/blog/javascript-trie-performance-analysis/

i have the dictionary of users names and surnames

Alex Woha
Mike Ivanov 
Donald Duck
Alex Wolf
John Wolf

and so on. Suppose user entered word

Wolf

I have to suggest him the next

Alex Wolf
John Wolf

If he entered

Wolf Al or Alex Wol

I have to suggest only

Alex Wolf

The dictionary is large, so i would prefer to use trie or dawg. How can i solve this problem?


Solution

  • So, i solve this problem by using ngram index (here is my implementation)