4 ms·
You can preprocess and normalize the data before you put it in the database. City/state is probably one of the easiest fields to do this with.
by staktrace 15y ago
You can preprocess and normalize the data before you put it in the database. City/state is probably one of the easiest fields to do this with.
- stinky613 15y agoI like the idea this article proposes, but I believe the author and our commenters glance over some backend difficulties. Yes, there are exactly 50 states each with precisely one two-letter abbreviation. How would you handle, say, "Boston, masachusetts" [sic]?
- spc476 15y agoI mentioned a method above (http://news.ycombinator.com/item?id=2825015 http://news.ycombinator.com/item?id=2825015) and since entering it, I've thought a bit more about the issue. Most instances will have only two words. If it's three or more and the last word isn't two characters, then if the second to last is one of "north", "south", "west", "new", "washington" or "puerto", then the last two words form the state and the rest is the city. And you can ignore any punctuation.
- stinky613 15y agoI like the idea this article proposes, but I believe the author and our commenters glance over some backend difficulties. Yes, there are exactly 50 states each with precisely one two-letter abbreviation. How would you handle, say, "Boston, masachusetts" [sic]?