-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatbot.py
More file actions
28 lines (26 loc) · 722 Bytes
/
chatbot.py
File metadata and controls
28 lines (26 loc) · 722 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
26
27
28
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
bot = ChatBot("irineu")
bot = ChatBot(
'Irineu',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
database_uri='sqlite:///database.sqlite3'
)
conversa = ListTrainer(bot)
conversa.train([
'Oi?',
'Eae',
'Qual o seu nome?',
'Irineu, você não sabe e nem eu',
'Prazer em te conhecer',
'Igualmente meu patrão',
])
while True:
try:
resposta = bot.get_response(input("Usuário: "))
if float(resposta.confidence) > 0.5:
print("Irineu: ", resposta)
else:
print("Eu não entendi :(")
except(KeyboardInterrupt, EOFError, SystemExit):
break