0

Want to create a new list from another larger list containing similar items from the larger list..My larger list contains values [Everton, QPR, Arsenal, Eveton, Manchester, Leicester, Leicster ..etc]

Wanted to find a way to create new lists containing largely similar items from the list above using regex..ie Everton and Eveton should be included in new list as they are largely similar.

Dont have code as I don't know how to do such an operation

Thanks

Lawrence Muriuki
  • 136
  • 1
  • 10
  • 2
    Have a look at this thread: [`fuzzywuzzy`](http://stackoverflow.com/questions/10383044/fuzzy-string-comparison) - you'll certainly won't succeed with a regex alone solution. – Jan May 08 '16 at 14:01

1 Answers1

0

You want to use an "edit distance" algorithm. There are a bunch of them, but a common "textbook" one is Levenshtein's.

There are some Python libraries of course, and also a relevant question with answers here: Edit Distance in Python

Community
  • 1
  • 1
John Zwinck
  • 239,568
  • 38
  • 324
  • 436