Update app.py
Browse files
app.py
CHANGED
|
@@ -15,12 +15,23 @@ def joke():
|
|
| 15 |
|
| 16 |
|
| 17 |
def wiki(name):
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 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:
|