Arafath10 commited on
Commit
cbad031
1 Parent(s): 9e5de06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -15,12 +15,23 @@ def joke():
15
 
16
 
17
  def wiki(name):
18
- #text = chatbot.get_response(name)
19
- name = name.lower()
20
- name = name.split()[-1]
21
- result = wikipedia.summary("ai", sentences=20)
22
- return result
23
-
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  def greet(name):
26
  if "who are you" in name or "who r u" in name:
 
15
 
16
 
17
  def wiki(name):
18
+ text = name
19
+ text = text.split("the")[-1]
20
+ text = text.split("is a")[-1]
21
+ text = text.split("by")[-1]
22
+ #print(wikipedia.search(text, results=20))
23
+ #print(text)
24
+ out = ""
25
+ for i in wikipedia.search(text, results=5):
26
+ try:
27
+ result = wikipedia.summary(i)
28
+ if " " in result.lower():
29
+ #print(result)
30
+ #print()
31
+ out = out + result+"\n"
32
+ except:
33
+ continue
34
+ return out
35
 
36
  def greet(name):
37
  if "who are you" in name or "who r u" in name: