[fix] use alphanumeric in generated component configs by default

This commit is contained in:
Al
2016-07-31 20:39:15 -04:00
parent 2e92c6fcc8
commit b727078be5

View File

@@ -463,12 +463,19 @@ class AddressComponents(object):
values = [] values = []
probs = [] probs = []
for num_type in (self.NULL_PHRASE, self.ALPHANUMERIC_PHRASE, self.STANDALONE_PHRASE): for num_type in (self.ALPHANUMERIC_PHRASE, self.NULL_PHRASE, self.STANDALONE_PHRASE):
key = '{}_probability'.format(num_type) key = '{}_probability'.format(num_type)
prob = prob_dist.get(key) prob = prob_dist.get(key)
if prob is not None: if prob is not None:
values.append(num_type) values.append(num_type)
probs.append(prob) probs.append(prob)
elif num_type in prob_dist:
values.append(num_type)
probs.append(1.0)
break
if not probs:
return None
probs = cdf(probs) probs = cdf(probs)
num_type = weighted_choice(values, probs) num_type = weighted_choice(values, probs)