简体   繁体   English

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

[英]OpenEars speech recognition detecting other words as correct ones

I am using OpenEars framework in my app to detect speech recognition. 我在我的应用程序中使用OpenEars框架来检测语音识别。 The idea is to listen for few words and then execute some actions depending on the word that has been said. 这个想法是听一些单词,然后根据所说的单词执行一些动作。 Well, recognition works and words are detected, but the problem is that with word "SNAPPIE" I am having some issues - other words that don't sound like it also get recognized as "SNAPPIE", sometimes even if I cough. 好了,识别工作和单词都被检测到了,但是问题是使用“ SNAPPIE”一词时我遇到了一些问题-听起来不像它的其他单词也被识别为“ SNAPPIE”,即使我咳嗽了。 Here is a piece of code I am using to set up listener: 这是我用来设置侦听器的一段代码:

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
  }

Is it possible that it could be a problem because "SNAPPIE" actually isn't a "valid" word? 是否可能因为“ SNAPPIE”实际上不是“有效”字词而引起问题?

You can create a random list of words using any online random word generator tool and then append your specific keywords that you want to recognise to the vocabulary. 您可以使用任何在线随机单词生成器工具创建单词的随机列表,然后将要识别的特定关键字附加到词汇表中。 This will improve the recognition of your specific keyword. 这将改善您对特定关键字的识别。 You will still have to compare the hypothesis text against your list of keywords though but the solution is good enough most of the times. 尽管您仍然需要将假设文本与关键字列表进行比较,但是大多数情况下解决方案已经足够好了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM