ruby-on-railsrubyajaxcoffeescriptmongoid5

Finding name variations from large list Ruby


I have a large list of words maybe 300-600 words and I want to make it so that as my user begins typing in a word the app suggest words that it found from my specific list that are close to the spelling that person is giving. Kind of like auto-complete but the list of words is dynamic and specific to that user. Any gems or techniques suggestions on how I can accomplish this?


Solution

  • If you want to do it in ruby you could use a fuzzy match algorithm, like the one used in this gem https://github.com/seamusabshere/fuzzy_match check the example:

    >> FuzzyMatch.new(['seamus', 'andy', 'ben']).find('Shamus')
    => "seamus"