pelias / api

HTTP API for Pelias Geocoder
http://pelias.io
MIT License
218 stars 162 forks source link

libpostal: discard parse containing single "suburb" label #1627

Open missinglink opened 2 years ago

missinglink commented 2 years ago

It seems that libpostal gets confused with airports, returning the label suburb:

curl --get http://localhost:4400/parse \
  --data-urlencode 'address=john f kennedy international airport'

[{"label":"suburb","value":"john f kennedy international airport"}]

However it returns the correct label for a neighbourhood:

curl --get http://localhost:4400/parse \
  --data-urlencode 'address=soho'

[{"label":"suburb","value":"soho"}]

And also in the case where the text refers to either an airport or a neighbourhood:

curl --get http://localhost:4400/parse \
  --data-urlencode 'address=tegel'

[{"label":"suburb","value":"tegel"}]

I think the best course of action here is to check for any parse containing a single label of type "suburb" and then discarding it. While this certainly will discard some valid neighbourhood parses, they should be adequately handled by the fallback parsing.

missinglink commented 2 years ago

falling back to the pelias/parser in these cases seems preferable:

Screenshot 2022-06-21 at 17 00 29 Screenshot 2022-06-21 at 17 00 50