Я пытаюсь запустить этот пример из: https://github.com/Uberi/speech_recognition/blob/master/examples/special_recognizer_features.py
Но при загрузке грамматики и попытке создать файл fsg выдается ошибка
# grammar example using Sphinx
try:
print("Sphinx recognition for \"one two three\" for counting grammar:")
print(r.recognize_sphinx(audio_en, grammar='counting.gram'))
except sr.UnknownValueError:
print("Sphinx could not understand audio")
except sr.RequestError as e:
print("Sphinx error; {0}".format(e))
Это вывод консоли:
PS C:\Users\fontalvos.5> & python c:/Users/fontalvos.5/Documents/workspacesTeleperformance/Python/SpeechReconigtion/Spinhx/spihnx.py
Sphinx recognition for "one two three" for counting grammar:
sphinxbase._sphinxbase
import ok
INFO: jsgf.c(709): Defined rule: <counting.g00000>
INFO: jsgf.c(709): Defined rule: <counting.g00001>
INFO: jsgf.c(709): Defined rule: PUBLIC <counting.counting>
INFO: jsgf.c(709): Defined rule: <counting.digit>
Traceback (most recent call last):
File "c:/Users/fontalvos.5/Documents/workspacesTeleperformance/Python/SpeechReconigtion/Spinhx/spihnx.py", line 18, in <module>
print(r.recognize_sphinx(audio, grammar=grammar_path))
File "C:\Users\fontalvos.5\AppData\Local\Programs\Python\Python37\lib\site-packages\speech_recognition\__init__.py", line 829, in recognize_sphinx
fsg.writefile(fsg_path)
AttributeError: 'NoneType' object has no attribute 'writefile'
Заранее спасибо ...