oops
This commit is contained in:
@@ -22,11 +22,11 @@ class NameGenerator:
|
|||||||
model[word[pos] + word[pos + 1]].append(word[pos + 2])
|
model[word[pos] + word[pos + 1]].append(word[pos + 2])
|
||||||
return model
|
return model
|
||||||
|
|
||||||
def make_name(self, model):
|
def make_name(self):
|
||||||
result = "<<"
|
result = "<<"
|
||||||
while True:
|
while True:
|
||||||
window = result[-2:]
|
window = result[-2:]
|
||||||
nxt = random.choice(model[window])
|
nxt = random.choice(self.model[window])
|
||||||
if nxt == ">":
|
if nxt == ">":
|
||||||
break
|
break
|
||||||
result += nxt
|
result += nxt
|
||||||
@@ -34,6 +34,6 @@ class NameGenerator:
|
|||||||
|
|
||||||
def generate_name(self):
|
def generate_name(self):
|
||||||
while True:
|
while True:
|
||||||
name = self.make_name(self.model)
|
name = self.make_name()
|
||||||
if self.validate and self.validate(name) is None:
|
if self.validate and self.validate(name) is None:
|
||||||
return name
|
return name
|
||||||
|
|||||||
Reference in New Issue
Block a user