February 28th, 2013, 09:31 PM
Join Date: Nov 2012
Time spent in forums: 7 h 18 m 33 sec
Reputation Power: 2
Pyspeech capture some 'keywords'
Hi, I'm looking for a way to use pyspeech to capture some keywords. For example, when i said the words "Play music", the python will have to run the function to play music. However, I have to use the specific word 'play music' to run that function.
My question is, is there a way to capture only a word 'music'?, no matters what i'm saying but if the pyspeech can capture the word 'music' in my sentence, it has to run the music function. For example, if i said 'I want to listen my music' or 'Run music' something like this it has to play music anyway. If you have some idea or solution to solve this problem, please help
Here is my code:
import speech, pymedia
player = pymedia.Player()
def command_callback(phrase, listener):
if phrase == 'Music':
speech.say("Preparing music. . .")
Command = speech.listenfor(['Music', 'Play music'],command_callback)