I am parsing a large CSV file in a ruby script and you need to find the closest header match to some search keys. Search keys can be one or more values, and the values may not match as below (should be close)
search_keys = ["big", "bear"]
A large array containing the data that I need to search, only to search in a column title:
array = [
["id", "title", "code", "description"],
["1", "once upon a time", "3241", "a classic story"],
["2", "a big bad wolf", "4235", "a little scary"],
["3", "three big bears", "2626", "a heart warmer"]
]
In this case, I would like it to return a string ["3", "three big bears", "2626", "a heart warmer"], as this is the closest match to my search keys.
I want it to return the closest match of the specified search keys.
Are there any helpers / libraries / gems that I can use? Has anyone done this before?
source