-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchat.py
More file actions
25 lines (22 loc) · 683 Bytes
/
chat.py
File metadata and controls
25 lines (22 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
class Chat_T:
chatbot: None
def __init__(self):
self.chatbot = ChatBot("ChatBot")
# Training with Personal Ques & Ans
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"You're welcome.",
"who Developed you",
"NLP class"
]
trainer = ListTrainer(self.chatbot)
trainer.train(conversation)
def chat(self, t1):
response = self.chatbot.get_response(t1)
return response