- This topic has 6 replies, 2 voices, and was last updated 7 years, 10 months ago by Halle Winkler.
May 12, 2015 at 8:44 pm #1025738
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.
-ErickMay 12, 2015 at 8:48 pm #1025739
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.May 12, 2015 at 9:13 pm #1025741
I am using the paid version of rejecto. (and SaveThatWave)May 12, 2015 at 9:22 pm #1025743
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.May 12, 2015 at 9:29 pm #1025745
I think the easiest place to copy them out of is the caches folder of the Simulator app sandbox.May 13, 2015 at 4:58 pm #1025756
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.May 13, 2015 at 5:08 pm #1025758
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.
- You must be logged in to reply to this topic.