MCPcopy Index your code
hub / github.com/geekcomputers/Python / wiki_search

Function wiki_search

VoiceAssistant/Project_Basic_struct/websiteWork.py:29–66  ·  view source on GitHub ↗

[Speak out the summary in wikipedia and going to the website according to user's choice.]

()

Source from the content-addressed store, hash-verified

27
28
29def wiki_search():
30 """[Speak out the summary in wikipedia and going to the website according to user's choice.]"""
31 wiki_search = "What do you want me to search on Wikipedia? Please tell me the exact sentence or word to Search."
32 wiki_search_link = "https://en.wikipedia.org/wiki/"
33
34 print(wiki_search)
35 speak(wiki_search)
36
37 query = hear()
38 try:
39 if query != "None":
40 results = wikipedia.summary(query, sentences=2)
41 print(results)
42 speak(results)
43
44 print("Do you want me to open the Wikipedia page?")
45 speak("Do you want me to open the Wikipedia page?")
46 q = hear().lower()
47
48 if (
49 "yes" in q
50 or "okay" in q
51 or "ok" in q
52 or "opun" in q
53 or "opan" in q
54 or "vopen" in q
55 or "es" in q
56 or "s" in q
57 ):
58 print(wiki_search_link + query)
59 webbrowser.open(wiki_search_link + query)
60
61 elif query == "None":
62 print("I could'nt understand what you just said!")
63 speak("I could'nt understand what you just said!")
64
65 except Exception:
66 print("Couldn't find")
67
68
69# wiki_search()

Callers 1

mainFunction · 0.85

Calls 3

speakFunction · 0.90
hearFunction · 0.90
summaryMethod · 0.45

Tested by

no test coverage detected