Dec-12-2018, 07:07 PM
I need a way to identify the closest matching list based on the string based on the sequence of words.
for example.
my_list = ['one', 'two', 'three' , 'four']
option_one = ['two', 'three', 'one', 'four']
option_two = ['four', 'three', 'two', 'one']
The closest sequence of the two options to my_list is option_one. The order of the positions are not the same as my_list but they are closer than option_two.
edit: to clarify, I'm looking for the closest match reading left to right in sequence. Though it doesn't equal my_list, it closer that option_two.
And that's about where my brain stops. I'm not sure of an elegant way to solve this. I'm not looking for a coded solution, but if anyone has an idea on how to go about solving it, I'm all ears.
Thanks!
for example.
my_list = ['one', 'two', 'three' , 'four']
option_one = ['two', 'three', 'one', 'four']
option_two = ['four', 'three', 'two', 'one']
The closest sequence of the two options to my_list is option_one. The order of the positions are not the same as my_list but they are closer than option_two.
edit: to clarify, I'm looking for the closest match reading left to right in sequence. Though it doesn't equal my_list, it closer that option_two.
And that's about where my brain stops. I'm not sure of an elegant way to solve this. I'm not looking for a coded solution, but if anyone has an idea on how to go about solving it, I'm all ears.
Thanks!