AlexaUsingPython - Alexa will pay attention to your order, as: Hello Alexa, play music, Hello Alexa

Overview

AlexaUsingPython

Alexa Has Only 2 Tasks to perform:

  1. Listen Alexa will pay attention to your order, as: "Hello Alexa, play music," "Hello Alexa, what's the time?" Alexa will pay attention to your order, get it, and afterward do some activity as indicated by your order.

  2. Speaking At the point when Alexa will comprehend your order after paying attention to it, it will play out some activity on it. Now let’s Implement Those Two Features: To implement these two features, we will require two Python modules:

    1. SpeechRecognition
    2. Python Text-To-Speech (pyttsx3)
  3. SpeechRecognition This Python module performs speech recognition. It helps Alexa to listen what we are saying, catch that, and act accordingly. Use the command below to install SpeechRecognition module, from your terminal: Once installed and imported, we can use it in our task.

  4. Python Text-To-Speech (pyttsx3) Text-to-Speech (TTS) module for Python works without internet or any delay. First you’ll have to install it:

Our Alexa can finally speak with the help of this module. Starting the Fun Part We’ll create three different functions and each will be responsible for a single task.

Step #1. Importing modules Let’s first import the modules:

Step #2. Initializing of modules To use them lets initialize them and make their objects:

Step #3. Create a method to convert text to speech - talk() method.

Step #4. Create a method for Speech Recognition

Step #5. Creating a method for response

Here, we need to understand a few things:

i. Fetching required part:
  Suppose you want to hear a specific song or music. You’ll speak to Alexa this way:
  Play music_name. Using this command, we will just remove the word ‘play’ and get only
  the ‘music_name’ part:

  And, then we will store that music name (without ‘Play’) in variable song.
ii) pywhatkit.playonyt():
  To use this module we have to install this module first and then import it. PyWhatKit
  has features to help us in automation. This module has a playonyt() method which we 
  will use to play the required songs directly on YouTube.
  First we’ll have to install it:

  And then import it.
iii. datetime.datetime.now():
  To use datetime Module first we have to install it and then import it. This module 
  helps us to manipulate dates and times. The method now() returns the current time, datetime 
  module is built-in Python module.
  Import it this way:

iv. wikipedia.summary():
  First we will need to install and import the Wikipedia module. This Python library makes it 
  easy to access data from Wikipedia. The summary() method gets the data from the summary 
  section of the Wikipedia.
  As we know it’s a third party module, then, we’ll have to install it first:

  And then import it in our code.
v. pyjokes.get_joke():
  First of all we have to install and import pyjokes module in order to use it in our program. This 
  module will generate some funny jokes randomly which our Alexa will crack.
  This is also a third-party module so first, we will have to install pyjokes.

  And then import it.

Step #6. Let’s run our Alexa

Finally, we make the call to the run_alexa() method.
Now we have created our own Alexa. Yay!
Using some Python skills and with the help of some other modules you can add more features to Alexa.

The Whole Code Now you can Enjoy your Alexa.

Owner
Abubakar Sattar
SEO expert and Web Developer with industry experience building websites and optimizing them for better ranking in Google. -Python -Cpp -Java -AI -ML
Abubakar Sattar
Python solution of advent-of-code 2021

Advent of code 2021 Python solutions of Advent of Code 2021 written by Eric Bouteillon Requirements The solutions were developed and tested using Pyth

Eric Bouteillon 3 Oct 25, 2022
Prototype application for GCM bias-correction and downscaling

dodola Prototype application for GCM bias-correction and downscaling This is an unstable prototype. This is under heavy development. Features Nothing!

Climate Impact Lab 9 Dec 27, 2022
Speed up your typing by some exercises in the multi-platform(Windows/Ubuntu).

Introduction This project purpose is speed up your typing by some exercises in the multi-platform(Windows/Ubuntu). Build Environment Software Environm

lyfer233 1 Mar 24, 2022
An unofficial opensource Pokemon cursor theme for Windows and Linux.

pokemon-cursor An unofficial opensource Pokemon cursor theme for Windows and Linux. Cursor Sizes 22 24 28 32 40 48 56 64 72 80 88 96 Colors Quick inst

Kaiz Khatri 72 Dec 26, 2022
Spooky Castle Project

Spooky Castle Project Here is a repository where I have placed a few workflow scripts that could be used to automate the blender to godot sprite pipel

3 Jan 17, 2022
Create beautiful diagrams just by typing mathematical notation in plain text.

Penrose Penrose is an early-stage system that is still in development. Our system is not ready for contributions or public use yet, but hopefully will

Penrose 5.6k Jan 08, 2023
A simple code for processing images to local binary pattern.

This figure is gotten from this link https://link.springer.com/chapter/10.1007/978-3-030-01449-0_24 LBP-Local-Binary-Pattern A simple code for process

Happy N. Monday 3 Feb 15, 2022
This program can calculate the Aerial Distance between two cities.

Aerial_Distance_Calculator This program can calculate the Aerial Distance between two cities. This repository include both Jupyter notebook and Python

InvisiblePro 1 Apr 08, 2022
Magenta: Music and Art Generation with Machine Intelligence

Magenta is a research project exploring the role of machine learning in the process of creating art and music. Primarily this involves developing new

Magenta 18.1k Jan 05, 2023
contextlib2 is a backport of the standard library's contextlib module to earlier Python versions.

contextlib2 is a backport of the standard library's contextlib module to earlier Python versions. It also sometimes serves as a real world proving gro

Jazzband 35 Dec 23, 2022
CDM Device Checker for python

CDM Device Checker for python

zackmark29 79 Dec 14, 2022
Print 'text color' and 'text format' on Term with Python

term-printer Print 'text color' and 'text format' on Term with Python ※ It may not work depending on the OS and shell used. PIP $ pip install term-pri

ななといつ 10 Nov 12, 2022
WATTS provides a set of Python classes that can manage simulation workflows for multiple codes where information is exchanged at a coarse level

WATTS (Workflow and Template Toolkit for Simulation) provides a set of Python classes that can manage simulation workflows for multiple codes where information is exchanged at a coarse level.

13 Dec 23, 2022
Draw random mazes in python

a-maze Draw random mazes in python This program generates and draws a rectangular maze, with an entrance on one side and one on the opposite side. The

Andrea Pasquali 1 Nov 21, 2021
AutoMetamon: Simple program to play Metamon automatically

AutoMetamon: Simple program to play Metamon automatically

Ngô Văn Tuấn 2 Sep 13, 2022
A little tool that uses LLVM to extract simple "what does this do" level instruction information from all architectures.

moirai: MOre InstRuctions and Information Backcronym. Anyway, this is a small project to extract useful instruction definitions from LLVM's platform d

2 Jul 30, 2022
Team10 backend - A service which accepts a VRM (Vehicle Registration Mark)

GreenShip - API A service which accepts a VRM (Vehicle Registration Mark) and re

3D Hack 1 Jan 21, 2022
Write-ups for CTF Internacional MetaRed 2021 5th stage

MetaRed2021-5th-Writeups Write-ups for CTF Internacional MetaRed 2021 5th stage Easy (15) No Status Category Name Creator(s) 01 Done osint Cybersecuri

UA Cybersecurity 2 Dec 22, 2021
清晰易读的7x7像素点阵中文字体和取模工具

FontChinese7x7 上古神器 III : 7x7像素点阵中文字体 想要在低分辨率屏幕上显示中文, 却发现中文字体实在是太大? 找了全网发现字体库最小也只有12x12? 甚至是好不容易找到了一个8x8字体, 结果发现字体收费且明确说明不得以任何形式嵌入到软件当中? 那就让这个项目来解决你的问

Angelic47 72 Dec 12, 2022
Library for mocking AsyncIOMotorClient built on top of mongomock.

mongomock-motor Best effort mock for AsyncIOMotorClient (Database, Collection, e.t.c) built on top of mongomock library. Example / Showcase from mongo

Michael Kryukov 43 Jan 04, 2023