From 7646adfc0f33b3abc2a230fd1803802c0d7cdca9 Mon Sep 17 00:00:00 2001 From: Al Date: Sat, 23 Jan 2016 23:23:58 -0500 Subject: [PATCH] [osm] Adding abbreviated street names in addition to the originals --- scripts/geodata/osm/osm_address_training_data.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/geodata/osm/osm_address_training_data.py b/scripts/geodata/osm/osm_address_training_data.py index e896923b..fd03e1e3 100644 --- a/scripts/geodata/osm/osm_address_training_data.py +++ b/scripts/geodata/osm/osm_address_training_data.py @@ -500,8 +500,10 @@ def build_ways_training_data(language_rtree, infile, out_dir): for lang, val in name_language.iteritems(): for s in val: if lang in languages: - s = osm_abbreviate(street_types_gazetteer, s, lang) writer.writerow((lang, country, tsv_string(s))) + abbrev = osm_abbreviate(street_types_gazetteer, s, lang, abbreviate_prob=1.0, separate_prob=0.5) + if abbrev != s: + writer.writerow((lang, country, tsv_string(abbrev))) if i % 1000 == 0 and i > 0: print('did {} ways'.format(i)) i += 1