Are there any algorithms that could find the closest match to a string from a rowset?

Are there any algorithms that could find the closest match to a string from a rowset? For instance:

string_to_match = 'What color is the sky?'

strings = [
  'What colour is the sea?', 
  'What colour is the sky?', 
  'What colour is grass?', 
  'What colour is earth?'
]

answer = method_using_string_matching_algorithm(string_to_match, strings)
answer # returns strings[1] 'What colour is the sky?'
+3
source share
1 answer

The search queries you are looking for are “lowercase remote algorithms” and “approximate string matching”. Google Quick Check includes interesting options, such as:

  • Sift3 Distance
  • Levenshtein Distance
  • Optimal line alignment distance
  • Distance Damerau-Levenshtein
  • Qwerty Keyboard Distance

Some useful links include:

Linux Debian agrep TRE-agrep .

+4

All Articles