openears语音识别将其他单词视为正确的单词



我在应用程序中使用openAres框架来检测语音识别。这个想法是听几句话,然后根据所说的单词执行一些动作。好吧,检测到识别作品和单词,但是问题在于,我遇到了一些问题 - 听起来不像它的其他单词也被识别为" snappie",有时即使我咳嗽也是如此。这是我用来设置侦听器的代码:

private func setupOpenEars() {
    _openEarsEventsObserver = OEEventsObserver()
    _openEarsEventsObserver.delegate = self
    OEPocketsphinxController.sharedInstance().disablePreferredBufferSize = true
    do {
      try OEPocketsphinxController.sharedInstance().setActive(true)
    } catch let error {
      print("There was an error setting Pocketsphinx as active: (error.localizedDescription)")
    }
    let grammarDictionary = ["ThisCanBeSaidOnce": [ "SNAPPIE", "TAKE SNAPSHOT" ]]
    let languageModelGenerator = OELanguageModelGenerator()
    let fileName = "FirstOpenEarsDynamicLanguageModel"
    let error = languageModelGenerator.generateGrammar(from: grammarDictionary, withFilesNamed: fileName, forAcousticModelAtPath: OEAcousticModel.path(toModel: "AcousticModelEnglish"))
    if let languageError = error {
      print("Dynamic language generator reported error: (languageError.localizedDescription)")
    } else {
      _pathToGeneratedLanguageModel = languageModelGenerator.pathToSuccessfullyGeneratedLanguageModel(withRequestedName: fileName)
      _pathToGeneratedDictionary = languageModelGenerator.pathToSuccessfullyGeneratedDictionary(withRequestedName: fileName)
    }
    _correctPathToMyLanguageModelFile = "(NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)[0])/(fileName).gram"
    OEPocketsphinxController.sharedInstance().vadThreshold = 3.5
  }

有可能是一个问题,因为" snappie"实际上不是"有效"的单词?

您可以使用任何在线随机单词生成器工具创建一个随机的单词列表,然后将您要识别的特定关键字附加到词汇上。这将提高对您特定关键字的认可。但是,您仍然必须将假设文本与关键字列表进行比较,但是在大多数情况下,解决方案就足够好了。

相关内容

最新更新