News for hackers. Stuff that matters.
Re:Parsing city of origin and destination city from a string by vidarh on Monday July 06, 2020 @08:57AM (#23747378)
And when you've dealt with the problems of the text extraction like in the long answer, you're left with the next huge problem: Context and inferring intent.

In the example, the poster shows inferring full location, not just the name in the example output.

Some examples where that gets tricky:

If I want driving instructions "from London to Hamilton" odds are I want London, Ontario to Hamilton, Ontario.

But what about "from London to York"? Without knowing more, I can't tell if that is in England or Ontario, and "knowing more" here involves a lot of guesses about in what context someone would qualify a name based on where they live relative to different locations with those names.

If I want "London to Paris" I could mean London, Ontario to Paris, Arkansas, but odds are very much I don't, because it seems unlikely someone far from either place would leave it unqualified. If that someone is close to either Ontario or Arkansas, it's tempting to think they'd still refer to the bigger place... But I see enough Candians on e.g. London Craigslist assuming it's for London, Ontario that this seems to depend on additional context.

But here be dragons. Qualified names are often still tricky to interpret unambiguously. Let's say I've against all odds been to Paris, Wisconsin once, and I want to go back there. Chances are I might write "to Paris, Wisconsin" or similar... But which one? Paris, Grant County, or Paris, Kenosha County"? Or I might even write "to Paris, USA" if I wasn't painfully aware there's at least a dozen Paris-es in the US.

And what about when I mess them up? When I started writing the paragraph above, I first mis-remembered and wrote Paris, Wyoming.. Joy...

From experience, you can get decent results on average with a dataset with size and population and assume that the bigger or more populated a place is, the larger is the region where it is likely to be the best choice, however. But there will be many that remains ambiguous.

But when you look at names that are very common and where many alternatives exist that are of a wide range of sizes, spread all over the place, that too becomes difficult. Examples: "from Santa Cruz to San Jose". California, right, because you have both names in the same state? Except that also applies to Arizona. Or New Mexico. To know whether people there would be likely to talk about them without specifying more detail, you need additional knowledge for each of these locations, and e.g. try to guess when some of the locations are too small for even relative "locals" to ignore them. And those are just the examples in the US that have both names in the same state, but there are dozens of both names across the Americas and further afield.

(As you might tell, I've spent too much time having to deal with location data...)

Re:Parsing city of origin and destination city from a string by wcarss on Monday July 06, 2020 @10:33AM (#23748291)
Just a tiny piece of extra information for your example: there's also a town called Paris in Ontario within ~100km of London (roughly on the path between London and Toronto) that has a picturesque appeal, so it's not a totally unlikely local car tourist destination.

And sitting here in Toronto, with an available-to-google frequent travel history to London, Ontario, searching "london ON to paris ON" is not enough for google to know what I mean.

This stuff is hard.

Re:Parsing city of origin and destination city from a string by vidarh on Monday July 06, 2020 @11:41AM (#23749063)
Thanks - I was totally unaware there's a Paris in Ontario too.

I was literally just thinking earlier that at least if someone finds something to add/correct, it will be awesome because it will just emphasise just how hard this problem is even for humans.

Re:Parsing city of origin and destination city from a string by madcaptenor on Monday July 06, 2020 @11:56AM (#23749203)
I just asked Google Maps for directions from "Birmingham" to "Leeds" to see what would come up, and got the message: 'Sorry, we could not calculate driving directions from "Birmingham, Alabama" to "Leeds, United Kingdom"'. Sure, but there's a Leeds in Alabama (a suburb of Birmingham) and a Birmingham in the UK.

(I'm in Atlanta; it's probably a safe guess that if I were making this query legitimately I'm asking for the Alabama one.)

Similarly for Birmingham to Oxford; there are reasonably prominent towns called Oxford in Alabama, Missisippi, and maybe Georgia, but it still insists on attempting to find a transatlantic driving route and failing.

Re:Parsing city of origin and destination city from a string by acheron on Monday July 06, 2020 @11:12AM (#23748758)
I have requested directions from Vienna to Paris before. ( https://www.bing.com/maps?osid=0dd3fe2f-ccc9-4899-8923-a5859... )

With enough context I could leave off any additional info when talking with a human, but there would likely never be "enough context" when asking a computer.