[addresses] Allowing null_phrase_probability for alpha, and alpha+digits instead of just for ordinals (mostly for Spain)

This commit is contained in:
Al
2016-05-27 13:40:38 -04:00
parent d4d8fa81d1
commit 6980565698

View File

@@ -257,7 +257,8 @@ class NumberedComponent(object):
elif num_type == 'ordinal' and safe_decode(num).isdigit(): elif num_type == 'ordinal' and safe_decode(num).isdigit():
num = ordinal_expressions.suffixed_number(num, language, gender=props.get('gender', None)) 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 return num
direction = props['direction'] direction = props['direction']