From 6980565698ba3cbf5dede8b9dac22b5d4bbfacdf Mon Sep 17 00:00:00 2001 From: Al Date: Fri, 27 May 2016 13:40:38 -0400 Subject: [PATCH] [addresses] Allowing null_phrase_probability for alpha, and alpha+digits instead of just for ordinals (mostly for Spain) --- scripts/geodata/addresses/numbering.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/geodata/addresses/numbering.py b/scripts/geodata/addresses/numbering.py index 45793cfd..b4504802 100644 --- a/scripts/geodata/addresses/numbering.py +++ b/scripts/geodata/addresses/numbering.py @@ -257,7 +257,8 @@ class NumberedComponent(object): elif num_type == 'ordinal' and safe_decode(num).isdigit(): num = ordinal_expressions.suffixed_number(num, language, gender=props.get('gender', None)) - if random.random() < props.get('null_phrase_probability', 0.0): + if (num_type == 'ordinal' or has_alpha) and 'null_phrase_probability' in props: + if random.random() < props['null_phrase_probability']: return num direction = props['direction']