如果没有更多代码,很难确切地说出您的问题是什么,但这里有一些我会尝试的事情:
设置委托时确保您的 OpenEarsEventObserver 对象不为零:
OpenEarsEventsObserver* openEarsEventsObserver = [[OpenEarsEventsObserver alloc] init];
[openEarsEventsObserver setDelegate:self];
确保你的 pocketsphinxController 不是 nil 并且你已经正确开始监听,为此我使用惰性实例化:
- (PocketsphinxController *)pocketsphinxController {
if (_pocketsphinxController == nil) {
_pocketsphinxController = [[PocketsphinxController alloc] init];
}
return _pocketsphinxController;
}
然后,当您想开始识别语音时:
[self.pocketsphinxController startListeningWithLanguageModelAtPath:<#(NSString *)#> dictionaryAtPath:<#(NSString *)#> acousticModelAtPath:<#(NSString *)#> languageModelIsJSGF:<#(BOOL)#>];
// Change "AcousticModelEnglish" to "AcousticModelSpanish" to perform Spanish recognition instead of English.
所有这些信息都可以在以下位置找到:OpenEars 教程