# Simple Desktop Assistant Example
import speech_recognition as sr
import pyttsx3
import wikipedia
import os
engine = [Link]()
def speak(text):
[Link](text)
[Link]()
def listen():
r = [Link]()
with [Link]() as source:
print("Listening...")
audio = [Link](source)
try:
command = r.recognize_google(audio)
print("You said:", command)
return [Link]()
except:
speak("Sorry, I didn't catch that.")
return ""
def main():
speak("How can I help you?")
while True:
command = listen()
if "wikipedia" in command:
topic = [Link]("wikipedia", "")
result = [Link](topic, sentences=2)
speak(result)
elif "open notepad" in command:
[Link]("[Link]")
elif "exit" in command:
speak("Goodbye!")
break
if __name__ == "__main__":
main()