[fix] use alphanumeric in generated component configs by default
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user