From 2fe127890192d4d75324f2f46ef4c7c0f9b5a530 Mon Sep 17 00:00:00 2001 From: bobloy Date: Wed, 29 Jul 2020 13:28:55 -0400 Subject: [PATCH] Attempt at functioning info --- chatter/chat.py | 12 ++++++------ chatter/info.json | 19 ++++++++++++++++--- chatter/requirements.txt | 5 ++++- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/chatter/chat.py b/chatter/chat.py index 06f0e16..2e6d41c 100644 --- a/chatter/chat.py +++ b/chatter/chat.py @@ -13,7 +13,7 @@ from redbot.core.data_manager import cog_data_path class ENG_LG: - ISO_639_1 = 'en_vectors_web_lg' + ISO_639_1 = 'en_core_web_lg' ISO_639 = 'eng' ENGLISH_NAME = 'English' @@ -32,7 +32,7 @@ class Chatter(Cog): path: pathlib.Path = cog_data_path(self) self.data_path = path / "database.sqlite3" - self.chatbot = self.create_chatbot(self.data_path, SpacySimilarity, 0.45, ENG_LG) + self.chatbot = self._create_chatbot(self.data_path, SpacySimilarity, 0.45, ENG_LG) # self.chatbot.set_trainer(ListTrainer) # self.trainer = ListTrainer(self.chatbot) @@ -42,7 +42,7 @@ class Chatter(Cog): self.loop = asyncio.get_event_loop() - def create_chatbot(self, data_path, similarity_algorithm, similarity_threshold, tagger_language): + def _create_chatbot(self, data_path, similarity_algorithm, similarity_threshold, tagger_language): return ChatBot( "ChatterBot", storage_adapter="chatterbot.storage.SQLStorageAdapter", @@ -64,14 +64,14 @@ class Chatter(Cog): after = datetime.today() - timedelta(days=(await self.config.guild(ctx.guild).days())) convo_delta = timedelta(minutes=(await self.config.guild(ctx.guild).convo_delta())) - def new_message(msg, sent, out_in, convo_delta): + def new_message(msg, sent, out_in, delta): if sent is None: return False if len(out_in) < 2: return False - return msg.created_at - sent >= convo_delta + return msg.created_at - sent >= delta for channel in ctx.guild.text_channels: if in_channel: @@ -151,7 +151,7 @@ class Chatter(Cog): await ctx.send_help() return - self.chatbot = self.create_chatbot(self.data_path, algos[algo_number][0], algos[algo_number][1], ENG_LG) + self.chatbot = self._create_chatbot(self.data_path, algos[algo_number][0], algos[algo_number][1], ENG_LG) await ctx.tick() diff --git a/chatter/info.json b/chatter/info.json index 739ddbe..b2607b5 100644 --- a/chatter/info.json +++ b/chatter/info.json @@ -4,21 +4,34 @@ ], "bot_version": [ 3, - 0, - 0 + 3, + 10 ], "description": "Create an offline chatbot that talks like your average member using Machine Learning", "hidden": false, "install_msg": "Thank you for installing Chatter! Get started ith `[p]load chatter` and `[p]help Chatter`", "requirements": [ + "git+git://github.com/gunthercox/chatterbot-corpus@master#egg=chatterbot_corpus", + "mathparse>=0.1,<0.2", + "nltk>=3.2,<4.0", + "pint>=0.8.1", + "python-dateutil>=2.8,<2.9", + "pyyaml>=5.3,<5.4", + "sqlalchemy>=1.3,<1.4", + "pytz", + "spacy>=2.3,<2.4", + "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_sm", + "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_md", + "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_lg", "chatterbot>=1.1" ], "short": "Local Chatbot run on machine learning", "tags": [ "chat", "chatbot", + "chatterbot", "cleverbot", "clever", "bobloy" ] -} \ No newline at end of file +} diff --git a/chatter/requirements.txt b/chatter/requirements.txt index d21e85f..f66b0d8 100644 --- a/chatter/requirements.txt +++ b/chatter/requirements.txt @@ -6,4 +6,7 @@ python-dateutil>=2.8,<2.9 pyyaml>=5.3,<5.4 sqlalchemy>=1.3,<1.4 pytz -spacy>=2.3,<2.4 \ No newline at end of file +spacy>=2.3,<2.4 +https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_sm +https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_md +https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz#egg=en_core_web_lg \ No newline at end of file