-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
47 lines (27 loc) · 839 Bytes
/
bot.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
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
import pandas as pd
data = pd.read_csv('C:\\Users\\agarw\\Downloads\\GooglePayIndia.csv')
selected_rows = data[~data['replyContent'].isna()]
rows = selected_rows[['content','replyContent']].values
bot = ChatBot('Bot5')
# Create a new trainer for the chatbot
trainer = ListTrainer(bot)
text = []
for row in rows[:5]:
#print(row)
text.append(row[0])
text.append(row[1])
print(text)
trainer.train(text)
# response = bot.get_response('How do add a boarding pass?')
# print('How do add a boarding pass?')
# print(response)
while True:
request=input('you :')
if request == 'OK' or request == 'ok':
print('Bot: bye')
break
else:
response=bot.get_response(request)
print('Bot:', response)