forked from DhruvBajaj01/Python_Practice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchatbot.py
53 lines (43 loc) · 1.43 KB
/
chatbot.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
41
42
43
44
45
46
47
48
49
50
51
52
53
from chatterbot.trainers import ChatterBotCorpusTrainer
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
my_bot = ChatBot(name='PyBot', read_only=True,
logic_adapters=['chatterbot.logic.MathematicalEvaluation',
'chatterbot.logic.BestMatch'])
corpus_trainer = ChatterBotCorpusTrainer(my_bot)
corpus_trainer.train('chatterbot.corpus.english')
list_trainer = ListTrainer(my_bot)
small_talk = ['hi there!',
'hi!',
'how do you do?',
'how are you?',
'i\'m cool.',
'fine, you?',
'always cool.',
'i\'m ok',
'glad to hear that.',
'i\'m fine',
'glad to hear that.',
'i feel awesome',
'excellent, glad to hear that.',
'not so good',
'sorry to hear that.',
'what\'s your name?',
'Jarvis'
]
#s =manipulations("/home/anwesan/Downloads/WhatsApp Chat with Skwad.txt")
#print(s)
for i in (small_talk):
list_trainer.train(i)
def get_answers(question):
return str(my_bot.get_response(question))
#done=False
#print("ask me anything \n to end process type in done/Done")
'''while not done:
q=input("question:")
if (q==("done") or (q==("Done"))):
done=True
continue
else :
l=get_answers(q)
print(l)'''