Commit ·
a9d7aab
1
Parent(s): 164a089
Upload Model.py
Browse files
model.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import wikipedia
|
| 2 |
+
|
| 3 |
+
def get_wikipedia_info(query):
|
| 4 |
+
# Get the information from Wikipedia.
|
| 5 |
+
try:
|
| 6 |
+
return wikipedia.summary(query, sentences=1)
|
| 7 |
+
except wikipedia.exceptions.PageError:
|
| 8 |
+
return "No information found for \"" + query + "\"."
|
| 9 |
+
|
| 10 |
+
choise = input('Enter what do you want to know >')
|
| 11 |
+
|
| 12 |
+
# Get the information about the United States.
|
| 13 |
+
info = get_wikipedia_info(choise)
|
| 14 |
+
|
| 15 |
+
# Display the information to the user.
|
| 16 |
+
print(info)
|