Reusing .DMP and .dic files?

Home Forums OpenEars Reusing .DMP and .dic files?

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

  • Author
    Posts
  • #1025738
    ekobres
    Participant

    Hi Halle,

    I have attempted to save references to the model and dictionary files created by the various generate… files and met with a brick wall when I try to feed these back in to startListening…:

    I know the path strings are valid, and that the files are there – yet I get this in the output window:

     Error: you have invoked the method:
    
    startListeningWithLanguageModelAtPath:(NSString *)languageModelPath dictionaryAtPath:(NSString *)dictionaryPath acousticModelAtPath:(NSString *)acousticModelPath languageModelIsJSGF:(BOOL)languageModelIsJSGF
    
    with a languageModelPath which is nil. If your call to OELanguageModelGenerator did not return an error when you generated this language model, that means the correct path to your language model that you should pass to this method's languageModelPath argument is as follows:
    
    NSString *correctPathToMyLanguageModelFile = [NSString stringWithFormat:@"%@/TheNameIChoseForMyLanguageModelAndDictionaryFile.%@",[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0],@"DMP"];
    
    Feel free to copy and paste this code for your path to your language model, but remember to replace the part that says "TheNameIChoseForMyLanguageModelAndDictionaryFile" with the name you actually chose for your language model and dictionary file or you will get this error again.

    Is it required to call the language model generator each time the app is started – or should this theoretically work?

    I’d like to avoid the expensive language model file creation at startup in cases where the model has not changed…

    Thanks in advance.

    -Erick

    #1025739
    Halle Winkler
    Politepix

    Hi Erick,

    Saving the LMs isn’t a feature of the demo version of the plugins, if you are using one of them to generate your LM. You can either access them with the standard OELanguageModelGenerator or with the paid version of the plugins.

    #1025741
    ekobres
    Participant

    I am using the paid version of rejecto. (and SaveThatWave)

    #1025743
    Halle Winkler
    Politepix

    OK, if you are sure the files are there and it’s the paid plugins, that will just be a path issue. There’s nothing preventing usage of a pre-existing model (although model generation time is extremely brief unless the model is quite large – generally some small fraction of a second). If you’re having difficulties I would first just make a copy of them and add them to the app bundle and reference them from there.

    #1025745
    Halle Winkler
    Politepix

    I think the easiest place to copy them out of is the caches folder of the Simulator app sandbox.

    #1025756
    ekobres
    Participant

    Hmm, I’ll play around with it some more.

    All I did was store the path string from the same instance variable I assigned it to originally – the same one that gets passed to startListening. There’s not much that can go wrong there – and I can see it’s the identical string – a file:// URL into the app cache library.

    The same call to startListening is being made using the same instance variables – they are just populated from NSUserDefaults rather than directly from pathToSuccessfullyGeneratedLanguageModelWithRequestedName and pathToSuccessfullyGeneratedDictionaryWithRequestedName.

    #1025758
    Halle Winkler
    Politepix

    OpenEars isn’t moving it around, so this should be solvable by troubleshooting. I’d start by just peeking at what’s in the Simulator bundle when you run, as a sanity check.

    OELanguageModelGenerator tries to abstract away the path management because it’s a common stumbling block for new developers, so my guess is the issue is coming up for you because you’re comfortable with dealing with the device file system and the way OELanguageModelGenerator tries to conceal it is making things more complex than necessary for you. I’d just start by eyeballing the container contents and I expect you’ll see whatever the issue is.

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