-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.py
More file actions
29 lines (24 loc) · 778 Bytes
/
Example.py
File metadata and controls
29 lines (24 loc) · 778 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
from chatbot import Chat, register_call
import wikipedia
import os
import warnings
warnings.filterwarnings("ignore")
@register_call("whoIs")
def who_is(query, session_id="general"):
try:
return wikipedia.summary(query)
except Exception:
for new_query in wikipedia.search(query):
try:
return wikipedia.summary(new_query)
except Exception:
pass
return "I don't know about "+query
if __name__ == '__main__':
first_question = ""
print("test")
chat = Chat(os.path.join(os.path.dirname(os.path.abspath(__file__)), "examples/Example.template"))
while(first_question !="quit"):
code = (input())
first_question = input()
print(chat.say(first_question,code))