I am working on a project to make the computer speak back when I give it commands. I just started, but when I run the code, it doesn't respond in the way I expect it to respond. Here is my code:
from pocketsphinx import LiveSpeech
import os
for phrase in LiveSpeech(): print(phrase)
if phrase == 'oh' :
os.system('espeak' ' "hi"')
I got an error when I run this code. Here is the error:
Traceback (most recent call last):
File "xxt", line 4, in <module>
print(phrase)
File "/Library/Python/2.7/site-packages/pocketsphinx/__init__.py", line 93, in __str__
return self.hypothesis()
File "/Library/Python/2.7/site-packages/pocketsphinx/__init__.py", line 126, in hypothesis
hyp = self.hyp()
File "/Library/Python/2.7/site-packages/pocketsphinx/pocketsphinx.py", line 359, in hyp
return _pocketsphinx.Decoder_hyp(self)
File "/Library/Python/2.7/site-packages/pocketsphinx/__init__.py", line 225, in stop
raise StopIteration
StopIteration
Thanks, Aditya