alexa in python

Solutions on MaxInterview for alexa in python by the best coders in the world

showing results for - "alexa in python"
Lena
01 Mar 2019
1import wolframalpha
2# pip install wolframalpha
3import pyttsx3
4# Pip install pyttsx3
5import speech_recognition as sr
6# pip install speech_rocognition
7
8
9
10#API key
11"""
12here you need to have an API key on wolframealpha.com
13"""
14client = wolframalpha.Client(API-Key)
15
16# Result
17res = client.query("a")
18r = sr.Recognizer()
19
20# recognition bot
21r = sr.Recognizer()
22
23# init pyttsx3
24engine = pyttsx3.init()
25
26
27# def
28def talk(speak):
29    engine.say(str(speak))
30    engine.runAndWait()
31
32
33# Main
34run = True
35while True:
36    try:
37        with sr.Microphone() as source2:
38            print("I am listening...")
39            r.adjust_for_ambient_noise(source2, duration=0.2)
40            audio2 = r.listen(source2)
41            MyText = r.recognize_google(audio2)
42            MyText = MyText.lower()
43            if MyText == "bye":
44                run = False
45                break
46            if run:
47                res = client.query(MyText)
48                print(next(res.results).text)
49                talk(next(res.results).text)
50
51    except:
52        engine.say("An error occurred...")
53        engine.runAndWait()
54
55
56engine.say("Bye...")
57engine.runAndWait()
Maximiliano
24 May 2016
1def  speak(audio):
2    engine.say(audio)
3    engine.runAndWait()
4
5def wishme():
6    hour = int(datetime.datetime.now().hour)
7    if hour>=0 and hour<12:
8        speak("good morning sir!")
9
10    elif hour>=12 and hour<18:
11        speak("good aternoon sir!")
12
13    else:
14        speak("Good Evening sir!")  
15
16    speak("i am jarvis. how may i help you")
Manuel
15 Jun 2019
1def takecommand():
2    r = sr.Recognizer()
3    with sr.Microphone() as source:
4        print("Listening...")
5        r.pause_threshold = 1
6        audio = r.listen(source)
7
8    try:
9        print("Recongnizing...")
10        query = r.recognize_google(audio, language='en-in')
11        print("User Said:", query)
12    except Exception as e:
13        # print(e)
14
15        print("say that again please...")
16        return "None"
17    return query
Ashley
03 Apr 2019
1import pyttsx3 
2import speech_recognition as sr
3import datetime
4import wikipedia
5import webbrowser
6import os
7import random
8
9from wikipedia import exceptions
10
11
12engine = pyttsx3.init('sapi5')
13voices = engine.getProperty('voices')
14# print(voices[0].id)
15engine.setProperty('voice', voices[1].id)
16
Oscar
15 Mar 2017
1if __name__ == "__main__":
2   wishme()
3   while 1:
4     query = takecommand().lower()
5
6     if 'wikipedia' in query:
7       speak('searching wikipedia...')
8       query = query.replace("wikipedia", "")
9       results = wikipedia.summary(query, sentences=2)
10       speak("According to wikipedia")
11       print("results")
12       speak(results)
13
14     elif 'open youtube' in query:
15         print("opening youtube...")
16         webbrowser.open("youtube.com")
17
18     elif 'open google' in query:
19         print("opening google...")
20         webbrowser.open("https://google.com")  
Angelo
14 Jul 2020
1171sb = SkillBuilder()
2172
3173sb.add_request_handler(LaunchRequestHandler())
4174sb.add_request_handler(JokeIntentHandler())
5175sb.add_request_handler(HelloWorldIntentHandler())
6176sb.add_request_handler(HelpIntentHandler())
7177sb.add_request_handler(CancelOrStopIntentHandler())
8178sb.add_request_handler(SessionEndedRequestHandler())
9179
10180# Make sure IntentReflectorHandler is last so it
11181# Doesn't override your custom intent handlers
12182sb.add_request_handler(IntentReflectorHandler())
13183
14184sb.add_exception_handler(CatchAllExceptionHandler())
15185
16186...
17
queries leading to this page
alexa requests pythonhow to code alexa skills pythonpython code for alexaalexa code for pythonmake alexa using pythonalexa python programming apphow to use alexa with pythonhow to create alexa skill in pythonmake alexa in pythonalexa python codeget alexa call pythonalexa pythonepython alexa packagehow to make an alexa skill with pythonhow to create alexa with pythonalexa project in pythonalexa using python school projecthow to program an alexa in pythonhow to code an alexa skill pythonhow to create alexa pythonhow to make local alexa skills in pythonalexa make your own oythoncode of alexa in pythonusing alexa with pythonhow to code alexa with pythondoes alexa execute python codehow make a alexa wit pythonalexa with python alexa python packagehow make a alexa with pythonalexa skill programming pythonalexa python tutorialalexa coding in pythoncool alexa skills with pythonpython own alexahow to make alexa write python codealexa python importalexa skill using pythonalexa skill development pythonpython create alexa skillbuild alexa using pythoncan you code alexa in python make my own alexa for free pyalexa free skills with pythonalexa pybasic alexa code no api python codealexa for pythonalexa code in pythonlearn python programming from scratch using alexahow to import a python library into alexa skillalexa python skill examplehow to build alexa with pythonalexa on python 3alexa skills with pythomalexa pythonpython alexa modulealexa make your own pythonhow to code an alexa skill in pythonis alexa made using pythonalexa python scripthow to create alexa skills with pythonmake your own alexa pythonalexa pyhow to do alexa in python codehow to make alexa skills in pythonalexa using pythonhow to make a amazon alexa skill with pythonalexa skill with pythonpython script to alexaalexa skills python tutorialpython code alexa desktop applicationamazon alexa pythonhow to make a alexa skill in pythonalexa no api python codealexa smart home skill pythonhow to create alexa in pythonalexa skill development in pythonhow to make an alexa using python alexa code in pythoncode for alexa in pythonhow to make an alexa skill pythonalexa python codingpython alexaalexa in pythonhow to make alexa in pythonown alexa pythonalexa amazon pythonpython alexa skill examplesimple alexa program pythonpython alexa codehow to make alexa pythonalexa in python