- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
Latest commit
40 lines (29 loc) · 909 Bytes
/
Copy pathmain.py
File metadata and controls
40 lines (29 loc) · 909 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
29
30
31
32
33
34
35
36
37
38
39
40
importsys
fromchatbot.chatbotimportChatBot
fromtrainer.trainimportTrainChatBot
#first parameter
input_command=sys.argv[1]
#second parameter (default = -1)
try:
input_attribute=sys.argv[2]
exceptIndexError:
input_attribute=-1
defrun(command, attribute):
chatbot=ChatBot('Chatbot')
ifcommand=='reply':
chatbot.respond(attribute)
elifcommand=='reply_instant':
response=chatbot.respondInstant(attribute)
print(response)
elifcommand=='train':
trainer=TrainChatBot(chatbot)
trainer.train()
elifcommand=='end':
ChatBot.endChat(attribute)
elifcommand=='serve':
server.run()
else:
print("Invalid Command")
print("Available Commands are [reply, reply_instant, train, end]")
#run function
run(input_command, input_attribute)