问题
I have a database of city names, but the problem is that it is not sanitized. For example, if Bangalore, India is a city then I might have the following locations in my database:
- Bangalore
- Bangalore, India
- Bangulore, India (misspelled)
- Bangalore,top city, India
- Bangalore, metropolitan, india
Now I would like to sanitize this data so that the only entry that remains after the sanitation is "Bangalore, India". I could use the data that LinkedIn or Facebook has, but I don't know if this is possible or not? Another approach could be to have a master list of city names and sanitize based on that, but this seems like a costly approach. Ideally, I'm looking for a service that would return the best matched city from a correct data set, when I'm passing any city name (correct or incorrect) as input. Any pointers would be appreciated.
来源:https://stackoverflow.com/questions/13681133/sanitizing-location-data