We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 92131cf commit 86ddb54Copy full SHA for 86ddb54
backend/PyMatcha/utils/chatbot_actions.py
@@ -0,0 +1,21 @@
1
+from chatterbot import ChatBot
2
+from chatterbot.trainers import ChatterBotCorpusTrainer
3
+from PyMatcha.utils.static import BACKEND_ROOT
4
+
5
6
+def get_chatbot_response(bot_name, user_input):
7
+ chatbot = ChatBot(
8
+ bot_name,
9
+ storage_adapter="chatterbot.storage.SQLStorageAdapter",
10
+ database_uri=f"sqlite:///{BACKEND_ROOT}/../chatbot_database.sqlite3",
11
+ )
12
13
+ trainer = ChatterBotCorpusTrainer(chatbot, show_training_progress=False)
14
+ trainer.train(
15
+ "chatterbot.corpus.english.conversations",
16
+ "chatterbot.corpus.english.emotion",
17
+ "chatterbot.corpus.english.greetings",
18
+ "chatterbot.corpus.english.humor",
19
+ "PyMatcha.utils.dating",
20
21
+ return chatbot.get_response(user_input)
0 commit comments