From 7cf6a2d747d70d3f0ef335b14f776271c0f15547 Mon Sep 17 00:00:00 2001 From: lickthecheese Date: Thu, 23 Apr 2020 16:05:16 -0400 Subject: [PATCH] fixed not responding bug --- modules/__pycache__/nlp.cpython-36.pyc | Bin 2337 -> 2440 bytes modules/nlp.py | 11 +++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/__pycache__/nlp.cpython-36.pyc b/modules/__pycache__/nlp.cpython-36.pyc index b187dfb2e10a60d9ec1c21a0bdb6aaf1e7243873..71e9b8172e8ed295857e24ec3f1e2f08bd659a53 100644 GIT binary patch delta 889 zcma)5%WD&15dUVM+0Dbe+9Vo7qs1ndAXc9GI zy#t8k2WY~aJcb@rWI_2@n-fB`l}PDakHAIt5}23Y6t`I-KhnL))bk^CG7Yfymk?9u z1*d;nMS8`vPyN^fHs#;6P)~}53jMy(6*3o0P75w zW#4F~?KRIC?5rYAP`)r0*B2-iX>Kq;Y%=TA#dF5k8h8(;L4$0+MIgY2YAhNUa03)* zL5?H?8r)IX%f}veB;QJd}gGd`rTn{^(;OElTG0%C}jKISJhxx6Y znd7OuO*7u2l%FFI)F(q~$DMIm=2JcWD#ar?PBr$I$iiiIRor+^C&WGet*N=58{DIW xZx9H`s0QF&vf5_c2zkR8Z-FOGX6B+X=~T7k51>SpS{YBA>9(}3vRX}9e*jdjs1g7G delta 754 zcma)4%}x|S5bm0u>6uv(q z9g|P#%!H55j)9<;gThe0qhxpGJGu#*@{HbbPjePt>k@t{r_AO)8l`2j$KGtLlF;2_ zZ(rqhIO37q?AqB`ZY2iV6^|T1SZa`*7{AZ5rbl8b)*)8qP)EuK=IZ8q0Kmr#R`%#Jt+jr nlmUN$r@-b*sQ7IS;~I3ryhy!8aQF(=g>dInxaCgMisSwT9utj` 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