I want to perform permissive/lenient string comparison in JavaScript like this:
Morocco = Moroco = Moroko = Morokko = Marocco = Maroco
Russia = Rusia
US = USA
Bucharest = Buharest
Afghanistan = Afganistan
Bangkok = Bankok
etc..
These comparisons will be used when operating with third-party APIs. I won't make any choices in my application based on them, but my goal is to provide the best options to the user. And the user will decide what's OK for him.
Would you point me the right way? The only idea comes to my mind is use character checksums and compare them. Maybe there could be better approach?
It would be nice also to get a "match integer" like:
var n = compare("Morocco", "Marocco"); // n = 95
var m = compare("Morocco", "Marokko"); // n = 85
but how to do that?
Thanks.