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
msgqywx 使用企业微信的应用消息推送实时信息

msgqywx 使用企业微信的应用消息推送实时信息

Demon Finch 8 Dec 18, 2022
The Python Fuzzer that the world deserves 🐍

pip3 install frelatage Current release : 0.0.2 The Python Fuzzer that the world deserves Installation | How it works | Features | Use Frelatage | Conf

Rog3r 219 Dec 21, 2022
Remote Worker

Remote Worker Separation of Responsibilities There are several reasons to move some processing out of the main code base for security or performance:

V2EX 69 Dec 05, 2022
Solves Maths24 problems for you!

maths24-solver Solves Maths24 problems for you! Enjoy this open scource project! You can edit modify and share! My wishes is for you to use this proje

6 Nov 07, 2021
A simple but flexible plugin system for Python.

PluginBase PluginBase is a module for Python that enables the development of flexible plugin systems in Python. Step 1: from pluginbase import PluginB

Armin Ronacher 1k Dec 16, 2022
A function decorator for enforcing function signatures

A function decorator for enforcing function signatures

Emmanuel I. Obi 0 Dec 08, 2021
ARA Records Ansible and makes it easier to understand and troubleshoot.

ARA Records Ansible ARA Records Ansible and makes it easier to understand and troubleshoot. It's another recursive acronym. What it does Simple to ins

Community managed Ansible repositories 1.6k Dec 25, 2022
Short, introductory guide for the Python programming language

100 Page Python Intro This book is a short, introductory guide for the Python programming language.

Sundeep Agarwal 185 Dec 26, 2022
This is a Python 3.10 port of mock, a library for manipulating human-readable message strings.

This is a Python 3.10 port of mock, a library for manipulating human-readable message strings.

Alexander Bartolomey 1 Dec 31, 2021
Comprehensive OpenAPI schema generator for Django based on pydantic

🗡️ Djagger Automated OpenAPI documentation generator for Django. Djagger helps you generate a complete and comprehensive API documentation of your Dj

13 Nov 26, 2022
A browser login credentials thief for windows and Linux

Thief 🦹🏻 A browser login credentials thief for windows and Linux Python script to decrypt login credentials from browsers in windows or linux Decryp

Ash 1 Dec 13, 2021
Write a program that works out whether if a given year is a leap year

Leap Year 💪 This is a Difficult Challenge 💪 Instructions Write a program that works out whether if a given year is a leap year. A normal year has 36

Rodrigo Santos 0 Jun 22, 2022
Controller state monitor plugin for EVA ICS

eva-plugin-cmon Controller status monitor plugin for EVA ICS Monitors connected controllers status in SFA and pushes measurements into an external Inf

Altertech 1 Nov 06, 2021
Password manager using MySQL and Python 3.10.2

Password Manager Password manager using MySQL and Python 3.10.2 Installation Install my-project with github git clone https://github.com/AyaanSiddiq

1 Feb 18, 2022
Online learning platform

🛠 Status: In Development Teached is currently in development. So we encourage you to use it and give us your feedback, but there are things that have

Mohamed Nesredin 2 Feb 07, 2021
Agora-token-helper - Some help tools for AgoraToken

Agora Token Helper Support AgoraToken version 001 - 006. But for security reason

LOL英雄联盟云顶之弈挂机刷代币脚本,全自动操作,智能逻辑,功能齐全。

LOL云顶之弈挂机刷代币脚本 这是2019年全球总决赛写的一个云顶挂机脚本,python完成的。 功能: 自动拿牌卖牌 策略是高星策略,非固定阵容 自动登陆账号、打码、异常重启 战利品截图上传百度云 web中控发号,改密码,查看信息等 代码是三天赶出来的,所以有点混乱,WEB中控代码也不知道扔哪去了

77 Oct 10, 2022
Transform your boring distro into a hacking powerhouse.

Pentizer Transform your boring distro into a hacking powerhouse. Pentizer is a personal project that imports Kali and Parrot repositories in any Debia

Michail Tsimpliarakis 2 Nov 05, 2021
免杀shellcode加载器

bypassAV 条件触发式远控 VT 5/70 免杀国内杀软及defender、卡巴斯基等主流杀软 原理 https://pureqh.top/?p=5412 use 将shellcode填至go_shellcode_encode.py生成混淆后的base64 payload 然后将生成的payl

405 Dec 14, 2022
A hackerank problems, solution repository

This is a repository for all hackerank challenges kindly note this is for learning purposes and if you wish to contribute, dont hesitate all submision

Tyler Mwalo Kenneth's 1 Dec 20, 2021