I'm trying to make a Python app, which behaves like Alexa, Cortana or Google's "Ok, Google".
I want it to constantly listen for a specific keyword. After it hears the keyword I want it to execute a function.
How can I do this?
I'm trying to make a Python app, which behaves like Alexa, Cortana or Google's "Ok, Google".
I want it to constantly listen for a specific keyword. After it hears the keyword I want it to execute a function.
How can I do this?
Take a look at Speech Recognition This is a library that allows speech recognition including Google Cloud Speech API.
Relating to the second part of your question this seems relevant:
How can i detect one word with speech recognition in Python
Once you can listen for a word just call your function.
import speech_recognition as sr
This code was adapted from this tutorial.
This will search for your keyword in the entire speech.
To improve your accuracy, you can even fetch all possible rhyming words and compare.
You can also do a character by character comparison to calculate the match percentage and set a minimum percentage threshold for the comparison success.