-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draft: parser interpretation improvements #1487
base: master
Are you sure you want to change the base?
Conversation
cases.push(['Kaschk Be', { subject: 'Kaschk Be' }, true]); | ||
cases.push(['Kaschk Ber', { subject: 'Kaschk Ber' }, true]); | ||
cases.push(['Kaschk Berl', { subject: 'Kaschk Berl' }, true]); | ||
cases.push(['Kaschk Berli', { subject: 'Kaschk Berli' }, true]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// this constant defines a lower boundary for the solution score returned | ||
// by the Pelias parser. Any solutions which scored lower than this value | ||
// will simply have their entire body returned as the $subject | ||
const MIN_ACCEPTABLE_SCORE = 0.3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users would probably appreciate this being tuneable via a config option.
Paired with pelias/parser#120 these tests all pass 🎉 |
09973da
to
67c9c81
Compare
@@ -100,33 +142,31 @@ function parse (clean) { | |||
.map((c, i) => (mask[i] !== 'P') ? c : ' ') | |||
.join(''); | |||
|
|||
// same as $body above but with consecutive whitespace squashed and trimmed. | |||
const normalizedBody = t.section.map(sp => sp.body).join(' ').replace(/\s+/g, ' ').trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not quite the same as above since it includes postalcode
classifications.
Need to give this some more consideration before merging 🤔
added an additional commit ac26263 to improve parsing of addresses where the unit number was previously being included in the $admin section of the parse: |
ac26263
to
639b3a9
Compare
rebased |
linking pelias/pelias#894 as it may be covered by this work |
draft: parser interpretation improvements
this will be paired with changes to
pelias/parser
which will need to be merged first.