I am trying to implement text suggestion in elm, where I have some data as List of Strings. I have tried so many ways for example, pattern matching, using Jaro-Winkler and Levenshtein distances, and bag of words model to find the best match in the data.
In the bag of words model, I can retrieve the most related sentence from the data, when I enter some text in the search box. I am doing it by converting all the search text and the data into words and then look in the data, where most of the words from the search text exist. I simply return that.
The problem is that If there are sentences with equal words in the data, then which one should I return?
SEARCH TEXT: " HELLO THERE JONNY"
LIST 1 IN DATA: " THERE ARE JONNY AND MIKE"
LIST 2 IN DATA: " THERE YOU GO JONNY"
both the list have 2 words equal to the search text, which one should I return? Is there any algorithm for this purpose? Can someone give me an idea?
Here is the Ellie: https://ellie-app.com/bnQNZmFJ59Va1