Compare commits

...

2 Commits

1 changed files with 10 additions and 1 deletions

View File

@ -55,6 +55,7 @@ async def genOut(self, noun):
end = [ i['word'] for i in shared.db['end'].find() ]
nouns = [i['word'] for i in shared.db['noun'].find()]
iter=0
coun=0
out = [noun]
while (out[0] not in beg or nouns.count(out[0])-1 > iter * shared.enmul) and iter < 7:
try:
@ -62,6 +63,7 @@ async def genOut(self, noun):
except IndexError:
iter += 69
iter += 1
coun += 1
iter = 0
while (out[-1] not in end or nouns.count(out[-1])-1 > iter * shared.enmul) and iter < 7:
@ -70,6 +72,13 @@ async def genOut(self, noun):
except IndexError:
iter += 69
iter += 1
coun += 1
if coun <= 3:
shared.enmul -= 1
elif coun >= 14:
shared.enmul += 1
return out
@ -111,7 +120,7 @@ async def init(self):
# sentance ending weight, lower means longer sentances,
# higher means shorter sentances. this will need to slowly
# get larger as the database grows
shared.enmul = 10
shared.enmul = 9
shared.rawm['nlp'] = filter