Closed missinglink closed 5 years ago
Similar to https://github.com/pelias/openaddresses/blob/af097099482b77bd0b13cc3e9af7f251dd1691ee/lib/streams/germanicAbbreviationStream.js although it uses aliases to index all possible forms rather than simply expanding.
Nice, so this would fix https://github.com/pelias/pelias/issues/555, right?
Yep
I tried to test this today. On my machine at least, using the seperable_street_names
branch with the OSM or OA importer causes the importer to hang.
This would be nice to test and merge if we get a chance to revisit it.
oh nice catch, I fixed it up and rebased it, the diff was:
diff --git a/Document.js b/Document.js
index 3426df3..ce1ff15 100644
--- a/Document.js
+++ b/Document.js
@@ -81,8 +81,13 @@ Document.prototype.toJSON = function(){
*/
Document.prototype.toESDocument = function() {
- // call all post-processing scripts
- this.callPostProcessingScripts();
+ try {
+ // call all post-processing scripts
+ this.callPostProcessingScripts();
+ } catch (e) {
+ console.error('a post processing error occurred');
+ console.error(e);
+ }
var doc = {
name: this.name,
diff --git a/post/seperable_street_names.js b/post/seperable_street_names.js
index 00b0dce..84f17b9 100644
--- a/post/seperable_street_names.js
+++ b/post/seperable_street_names.js
@@ -77,7 +77,7 @@ function post(doc) {
if( !TARGET_LAYERS.includes( doc.getLayer() ) ) { return; }
// detect document country code
- let docCountryCode = doc.parent.country_a[0];
+ let docCountryCode = _.get(doc, 'parent.country_a[0]');
if( !_.isString(docCountryCode) || docCountryCode.length !== 3 ) { return; }
Fixed another bug, turns out real-world data is messy, who would have thought 🤷♂
I tested this out and it works well now, good to merge.
add post processing script to generate expanded and contracted forms of compound street names
This is a PR I've been wanting to do for a while now, it generates aliases for contracted/expanded forms of street names.