-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot_trainer.py
40 lines (37 loc) · 1.02 KB
/
bot_trainer.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
class BotTrainer(object):
conver= [
"Hello",
"Hi there!",
"How are you?",
"I am good.",
"How are you doing?",
"I'm doing great.",
"Where do you live?",
"I live in Mumbai",
"Where are you from?",
"I live in Navi Mumbai",
"Where in navi mumbai?",
"Cbd bealpur",
"Are you robot or human?",
"I am human ofcourse.",
"That is good to hear",
"Me too",
"Thank you.",
"You're welcome.",
"I need a job",
"That's great.Please, enter the position for which you want the job"
"I am looking for a job",
"That's great.Please, enter the position for which you want the job"
]
chatbot = ChatBot("Ron Obvious")
def __init__(self):
chatbot = self.chatbot
chatbot.train("chatterbot.corpus.english")
chatbot.set_trainer(ListTrainer)
chatbot.train(self.conver)
def respond(self, text):
ans=self.chatbot.get_response(text)
ans=str(ans)
return ans