Created
February 17, 2019 03:36
-
-
Save timxor/92efa66f7afcd7eb1221aa38b92a3e36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@shared_task | |
def decode_speech(audio_file): | |
decoder.decode_phrase(audio_file) | |
# If the keyword "ordenador" is spotted, then switch to jsgf mode | |
# Speech Example: Ordenador show me photos of Sara | |
if decoder.get_hyp() == "ordenador": | |
print ("BINGOOOO") | |
print(decoder.get_search_method()) | |
decoder.set_search("grammar") | |
# Grammar search for " show me photos of Sara" which is defined in jsgf file, so phrase_recognized get that value. | |
phrase_recognized = decoder.get_hyp() | |
print (phrase_recognized) | |
else: | |
# If no keyword spotted, switch to kws mode | |
decoder.set_search("keyword") | |
phrase_recognized = "" | |
# if decoder.get_hyp() == "": | |
# phrase_recognized = "" | |
# else: | |
# phrase_recognized = decoder.get_hyp() | |
return phrase_recognized |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment