NSArray *languageArray = @[@"BACK", @"NEXT", @"REPEAT"];
OELanguageModelGenerator *languageModelGenerator = [[OELanguageModelGenerator alloc] init];
// languageModelGenerator.verboseLanguageModelGenerator = TRUE; // Uncomment me for verbose debug output
// generateLanguageModelFromArray:withFilesNamed returns an NSError which will either have a value of noErr if everything went fine or a specific error if it didn't.
NSError *error = [languageModelGenerator generateRejectingLanguageModelFromArray:languageArray withFilesNamed:@"OpenEarsDynamicGrammar" withOptionalExclusions:nil usingVowelsOnly:NO withWeight:nil forAcousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"]];
NSDictionary *dynamicLanguageGenerationResultsDictionary = nil;
if([error code] != noErr) {
NSLog(@"Dynamic language generator reported error %@", [error description]);
} else {
dynamicLanguageGenerationResultsDictionary = [error userInfo];
NSString *lmFile = [dynamicLanguageGenerationResultsDictionary objectForKey:@"LMFile"];
NSString *dictionaryFile = [dynamicLanguageGenerationResultsDictionary objectForKey:@"DictionaryFile"];
NSString *lmPath = [dynamicLanguageGenerationResultsDictionary objectForKey:@"LMPath"];
NSString *dictionaryPath = [dynamicLanguageGenerationResultsDictionary objectForKey:@"DictionaryPath"];
NSLog(@"Dynamic language generator completed successfully, you can find your new files %@\n and \n%@\n at the paths \n%@ \nand \n%@", lmFile,dictionaryFile,lmPath,dictionaryPath);
}
it hangs.
]]>Dynamic language generator completed successfully, you can find your new files (null)
and
(null)
at the paths
(null)
and
(null)
dynamicLanguageGenerationResultsDictionary = [error userInfo]; NSString *lmFile = [dynamicLanguageGenerationResultsDictionary objectForKey:@"LMFile"]; NSString *dictionaryFile = [dynamicLanguageGenerationResultsDictionary objectForKey:@"DictionaryFile"]; NSString *lmPath = [dynamicLanguageGenerationResultsDictionary objectForKey:@"LMPath"]; NSString *dictionaryPath = [dynamicLanguageGenerationResultsDictionary objectForKey:@"DictionaryPath"];
To see how this works now, take a look at the upgrade guide under the section “Step 5: architectural changes.”:
If you’ve been using 1.x, even if you’re making a new app, it’s a good idea to read the upgrade guide and the headers for the classes you’re using (or their docs) to find out about API changes. The sample app and tutorial are up to date with 2.0, so it’s fine to copy and paste code out of them.
]]>If I have a static language model do I still require the rejecto plugin in my project which uses that language model?
Yes, this is a requirement.
]]>