diff --git a/modules/__pycache__/nlp.cpython-36.pyc b/modules/__pycache__/nlp.cpython-36.pyc index b187dfb..71e9b81 100644 Binary files a/modules/__pycache__/nlp.cpython-36.pyc and b/modules/__pycache__/nlp.cpython-36.pyc differ diff --git a/modules/nlp.py b/modules/nlp.py index 22c8f25..545d890 100644 --- a/modules/nlp.py +++ b/modules/nlp.py @@ -35,11 +35,18 @@ async def genOut(self, noun): iter=0 out = [noun] while (out[0] not in beg or nouns.count(out[0])-1 > iter * self.enmul) and iter < 7: - out = [ random.choice(list(prew.find(pro=out[0])))['pre'] ] + out + try: + out = [ random.choice(list(prew.find(pro=out[0])))['pre'] ] + out + except IndexError: + iter += 69 iter += 1 iter = 0 while (out[-1] not in end or nouns.count(out[-1])-1 > iter * self.enmul) and iter < 7: - out.append(random.choice(list(prew.find(pre=out[-1])))['pro']) + + try: + out.append(random.choice(list(prew.find(pre=out[-1])))['pro']) + except IndexError: + iter += 69 iter += 1 return out