Skip to content

Made point hint matching stricter and avoid problems for short street names - #1406

Merged
karussell merged 9 commits into
masterfrom
pointhint_1404
Jun 20, 2018
Merged

karussell merged 9 commits into
masterfrom
pointhint_1404

Conversation

@karussell

@karussell karussell commented Jun 20, 2018 •

Copy link
Copy Markdown
Member

The biggest change is that with this PR we require now the input to be just the street and not the full address to improve matching. Was able to increase the JARO_WINKLER_ACCEPT_FACTOR from under 0.8 to 0.9

Also it:

  • Fixes point hint problem #1404
  • ignores words with length<2 instead length<3 and a certain set of "street" words
  • does not ignore words that could make the difference like parts of the street ("ben")
  • introduces a rewriteMap so that the filter can be improved for other cases and languages without a code change
  • a clean up and include some ignored tests
  • made JaroWinkler instance static (tiny memory usage reduction)

@karussell karussell added the bug label Jun 20, 2018
@karussell karussell added this to the 0.11 milestone Jun 20, 2018
@karussell
karussell requested a review from boldtrn June 20, 2018 07:51
@boldtrn

boldtrn commented Jun 20, 2018

Copy link
Copy Markdown
Member

we require now the input to be just the street and not the full address to improve matching

This is a really good change! It was quite hard to get the matching right in some cases with full addresses.

@boldtrn boldtrn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the approach but I think we should add some more common road names to the overwrite logic just to cover some more cases, WDYT?

put("straße", "");
put("strasse", "");
put("st.", ""); // saint vs. street
put("street", "");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewriting to an empty string could be problematic in some more exotic cases. But I think the alternatives also introduce potential errors, so this is probably the best approach.

I miss a couple of strings here (not sure if they get abbreviated though, so maybe it's better not to add them?):
strada (e.g. Strada Provinciale 209)
via (e.g. Via Fosso Ancaiano)
calle (Calle el Dr. Mabuse)
plaza (Plaza de la Bámbola)

Some English ones:
lane
ln. (short form of lane)
place
pl.
track
tr.
pathway
path
crescend
cres
cres.
parade
pde

I found a great resource for street abbreviations in English here. An even longer list can be found here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :)
We could even extract them from OSM:
https://github.com/komoot/photon/pull/46/files#diff-751e12c3a9da7a1987a479baab0ff97c
https://github.com/karussell/languator

But probably we should not overcomplicate things here and improve this just a bit.

Another question is how we handle those common words if they are part of the street name like with "Hauptstraße" we can't just remove them because e.g. st could be a part of a street name without the street-meaning

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another question is how we handle those common words if they are part of the street name like with "Hauptstraße" we can't just remove them because e.g. st could be a part of a street name without the street-meaning

Yes I think we cannot really do anything about these without introducing bigger errors as well.

But probably we should not overcomplicate things here and improve this just a bit.

I know that English speakers love abbreviations, so I think fixing the English abbreviations is quite important. The names I mentioned above are pretty common, the ones in the first link are quite common as well, the second link contains more uncommon ones as well. But Google Maps loves to abbreviate them in english speaking countries as well, most abbreviations are rather short like Drive and Dr, so the dr will be removed anyway. So I think if anyone tries to combine the point_hint with GMaps Geocoding, this will become an issue.

"sq.", "square",
"tr.", "track",
"via")) {
put(remove, "");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this is now sufficient and we could add new stuff if required later? I think adding all these words does not necessarily improve the result. We probably could try an automated way to find areas where our snapping is not optimal now. E.g. pick a location and 4 close streets and pick one street to see if the others get rejected or similar.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sure, we can always add more later and see how we go :).

Personally, I would add:
crescend, cres, cres., parade, pde, pde., boulevard, bvd, bvd.

These are really common ones. In GB there are many Close, Cl, which could make sense to add as well. Probably we just need to see how we go.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added a few as requested :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :). Let's see how we go then :)

"sq.", "square",
"tr.", "track",
"via")) {
put(remove, "");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sure, we can always add more later and see how we go :).

Personally, I would add:
crescend, cres, cres., parade, pde, pde., boulevard, bvd, bvd.

These are really common ones. In GB there are many Close, Cl, which could make sense to add as well. Probably we just need to see how we go.

@karussell
karussell merged commit 0da97d0 into master Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants