Skip to content

Add Mt/St/Ft normalizing - #767

Merged
trescube merged 4 commits into
masterfrom
add-mt-st-ft-normalizing
Dec 14, 2016
Merged

trescube merged 4 commits into
masterfrom
add-mt-st-ft-normalizing

Conversation

@trescube

@trescube trescube commented Dec 13, 2016 •

Copy link
Copy Markdown
Contributor

WOF names are spelled out as Mount and Fort whereas Saint and Sainte are abbreviated to St and Ste, respectively. This PR adds a sanitizer that transliterates:

  • Mt -> Mount
  • Ft -> Fort
  • St -> Saint
  • Ste -> Sainte

This will ensure that, for example, searching for Saint Louis, MO and St. Louis return the same results.

Fixes pelias/schema#157

more accurate since it's smarter about where to replace periods
Comment thread sanitizer/search.js Outdated
quattroshapes_deprecation: require('../sanitizer/_deprecate_quattroshapes'),
text: require('../sanitizer/_text'),
iso2_to_iso3: require('../sanitizer/_iso2_to_iso3'),
mount_saint_fort_standardizer: require('../sanitizer/_mount_saint_fort_standardizer'),

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.

might we want to expand this in the future so that it's less specific and more of an "abbreviation_standardizer"? It feels a bit too specific of a name

const transliterated = periods_removed.replace(mountSaintFort, transliterate);

// 3. whitespace-normalize by replacing much whitespace with a space and trimming
// duplicate whitespace can be introduced when removing periods

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 think there's a missing word in here. should it be "and trimming duplicate whitespace that can be introduced when removing periods" (or something similar)

const messages = { errors: [], warnings: [] };

// only try to transliterate if there is a city in parsed_text
if (!_.isEmpty(_.get(clean, 'parsed_text.city'))) {

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.

woah _.get is kinda nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants