Changing LanguageModel on the Fly

Home Forums OpenEars Changing LanguageModel on the Fly

Viewing 7 posts - 1 through 7 (of 7 total)

  • Author
    Posts
  • #1032652

    Saatyagi
    Participant

    hey

        func changeLanguageModel(wordsArray: [String], dictionaryName: String) {
            if (OEPocketsphinxController.sharedInstance()?.isListening)! {
                let err: Error! = lmGenerator.generateLanguageModel(from: wordsArray, withFilesNamed: dictionaryName, forAcousticModelAtPath: OEAcousticModel.path(toModel: englishModel))
                if(err != nil) {
                    NSLog("Error while changing language model: \(String(describing: err))")
                } else {
                    lmPath = lmGenerator.pathToSuccessfullyGeneratedLanguageModel(withRequestedName: dictionaryName)
                    dicPath = lmGenerator.pathToSuccessfullyGeneratedDictionary(withRequestedName: dictionaryName)
                    OEPocketsphinxController.sharedInstance()?.changeLanguageModel(toFile: lmPath, withDictionary: dicPath)
                    NSLog("Successfully changed language model to : \(dictionaryName)")
                    NSLog("Successfully changed language command to : \(wordsArray.description)")
                }
            } else {
                NSLog("Start Openears first")
            }
        }

    It is getting executed successfully but neither changing or I’m getting the callback

    func pocketsphinxDidChangeLanguageModel(toFile newLanguageModelPathAsString: String!, andDictionary newDictionaryPathAsString: String!)

    Help please.
    it use to work earlier with demo version. Now I’ve paid one and boom no work.

    #1032653

    Saatyagi
    Participant
    
    OpenEarsHelper.openEarsHelper.changeLanguageModel(wordsArray: RapidEarsCMDArrays.phoneticCommands, dictionaryName: RapidEarsCMDArrays.phoneticCmdDict)
    

    Above is my calling method and

    
     // Commands used on Fuel intent's Review Order Page
        static let phoneticCmdDict: String = "PhoneticCmdDict"
        static let phoneticCommands: [String] = ["Alpha", "Beta", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliett", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-ray", "Yankee","Zulu"]
    

    is my dictionary and words array.

    • This reply was modified 5 months, 1 week ago by  Saatyagi.
    #1032655

    Halle Winkler
    Politepix

    Hi Saatyagi,

    I think you may be experiencing this issue with callbacks:

    https://www.politepix.com/forums/topic/rapidearsdidreceivelivespeechhypothesis-not-firing/#post-1032229

    Please give the fix I describe in the linked reply a try, and let me know if it works for you.

    #1032656

    Saatyagi
    Participant

    Hey Thanks for the reply
    but I already have that implemented :-

    
    class OpenEarsHelper: NSObject, OEEventsObserverDelegate, OEEventsObserverRapidEarsDelegate {
    
    #1032657

    Saatyagi
    Participant

    and it’s not about callback
    I want to change words array on the fly which is not happening right now

    #1032658

    Halle Winkler
    Politepix

    Hi,

    Language model switching is performed by OpenEars.framework rather than by RapidEars.framework or RapidEarsDemo.framework, so it is kind of unlikely that the issue is related to switching from the RapidEars demo to the licensed version despite it appearing at that time (I won’t say it’s impossible, but I am not personally aware of a way that it could occur due to the fact that RapidEars doesn’t perform that function).

    RapidEars only adds changes to speech processing, and callbacks, so those would be the only things I could offer advice with specifically regarding your new RapidEars framework, but it sounds like you are confident that you are receiving all RapidEars and OpenEars callbacks, is that correct?

    This is a bit of a tricky one because there also isn’t any difference in speech code between the demo and the licensed version; there is just the timeout after a few minutes in one and the license checking in the other as differences. It would be unusual to get any kind of a behavioral change in the actual engine as a result of changing over to the licensed version since there isn’t different engine code.

    If you are definitely receiving all expected callbacks from OpenEars and from RapidEars, I would recommend beginning by taking standard troubleshooting steps to see what the issue might be. Step one would be to turn on OpenEarsLogging and verbosePocketsphinx and verboseRapidEars, and see if there is anything in the logging to let you know what is happening when you switch models. Please feel free to show me the logs (it’s fine to do a search/replace for private info in there as long as you show me all of the OpenEars logging from the beginning to the end of the app session without removing any of the OpenEars logging in between).

    #1032659

    Halle Winkler
    Politepix

    Can you take another look at the link to the RapidEars callbacks workaround and make sure that you also made the described modifications to RapidEars.framework? I’m talking about the part at the beginning that begins “In the RapidEars framework’s header file OEEventsObserver+RapidEars.h”:

    https://www.politepix.com/forums/topic/rapidearsdidreceivelivespeechhypothesis-not-firing/#post-1032229

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.