Skip to content

Commit

Permalink
Merge pull request #56 from HSLdevcom/trust-libpostal
Browse files Browse the repository at this point in the history
DT-2307
  • Loading branch information
siren authored Dec 27, 2017
2 parents cf101b7 + 58e58f4 commit 04c48e9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sanitizer/_text_addressit.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ function assignValidLibpostalParsing(parsedText, fromLibpostal, text) {

const street = fromLibpostal.street;
if(street) {
if((!parsedText.name || parsedText.name===street) && !parsedText.number) {
// plain parsed street is suspicious as Libpostal often maps venue name to street
// better to search it via name
if(!parsedText.name) {
parsedText.name = street;
} else {
if(parsedText.number ) {
parsedText.name = parsedText.name + ' ' + parsedText.number;
}
}
if(parsedText.number) {
// plain parsed street is suspicious as Libpostal often maps venue name to street
// better to search it only via name, if no number is parsed
parsedText.street = street;
}
}
Expand Down

0 comments on commit 04c48e9

Please sign in to comment.