From 3a8c3dfcf64deb830329f72ae8c10a1cd6a2f95c Mon Sep 17 00:00:00 2001 From: Al Date: Sat, 23 Jan 2016 21:51:40 -0500 Subject: [PATCH] [fix] spacing in phrases at end of string --- scripts/geodata/osm/osm_address_training_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/geodata/osm/osm_address_training_data.py b/scripts/geodata/osm/osm_address_training_data.py index bca06990..b58f3c87 100644 --- a/scripts/geodata/osm/osm_address_training_data.py +++ b/scripts/geodata/osm/osm_address_training_data.py @@ -412,7 +412,7 @@ def osm_abbreviate(gazetteer, s, language, abbreviate_prob=0.3, separate_prob=0. token = random.choice(abbreviations) if abbreviations else canonical token = recase_abbreviation(token, tokens[i:i + len(t)]) abbreviated.append(token) - if i < n - 1 and raw_tokens[i + len(t)][0] > sum(raw_tokens[i + len(t) - 1][:2]): + if i + len(t) < n - 1 and raw_tokens[i + len(t)][0] > sum(raw_tokens[i + len(t) - 1][:2]): abbreviated.append(u' ') break elif is_prefix: