From 11fca2894066ff1dcdd6946393d5f13a2ce14479 Mon Sep 17 00:00:00 2001 From: xfnw Date: Mon, 26 Jul 2021 12:51:02 -0400 Subject: [PATCH] pad punctuation --- modules/nlp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/nlp.py b/modules/nlp.py index 01a9443..c105e45 100644 --- a/modules/nlp.py +++ b/modules/nlp.py @@ -1,8 +1,6 @@ from bot import * -import dataset -import random -import time +import dataset, random, time, re async def rec(self, m): prew = shared.db['prew'] @@ -94,7 +92,7 @@ async def filter(self, c, n, m): async def go(self, c, n, m): await rec(self, m) - words = m.split(' ') + words = re.sub(r'([\.,\?!])', r' \1', m).split() if words[0] == 'admin': return await self.message(c, ' '.join(await genOut(self, await getNoun(self, words, c)))) @@ -110,7 +108,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 = 7 + shared.enmul = 6 shared.rawm['nlp'] = filter