-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
40 lines (29 loc) · 909 Bytes
/
main.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
import sys
from chatbot.chatbot import ChatBot
from trainer.train import TrainChatBot
#first parameter
input_command = sys.argv[1]
#second parameter (default = -1)
try:
input_attribute = sys.argv[2]
except IndexError:
input_attribute = -1
def run(command, attribute):
chatbot = ChatBot('Chatbot')
if command == 'reply':
chatbot.respond(attribute)
elif command == 'reply_instant':
response = chatbot.respondInstant(attribute)
print(response)
elif command == 'train':
trainer = TrainChatBot(chatbot)
trainer.train()
elif command == 'end':
ChatBot.endChat(attribute)
elif command == 'serve':
server.run()
else:
print("Invalid Command")
print("Available Commands are [reply, reply_instant, train, end]")
#run function
run(input_command, input_attribute)