Home › Forums › OpenEars plugins › [Resolved] Language mode generator + rejecto not working
Tagged: Rejecto
- This topic has 4 replies, 2 voices, and was last updated 9 years, 4 months ago by Halle Winkler.
-
AuthorPosts
-
December 11, 2014 at 3:08 pm #1023407nrbrookParticipant
If I create a new iOS project, set the -ObjC linker flag, drag in Open ears, rejecto, the acoustic models, and in viewDidAppear add:
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.
December 11, 2014 at 3:15 pm #1023409nrbrookParticipantOk, thanks, however now the same code outputs:
Dynamic language generator completed successfully, you can find your new files (null)
and
(null)
at the paths
(null)
and
(null)December 11, 2014 at 3:27 pm #1023410Halle WinklerPolitepixThis isn’t how the paths are referenced in 2.0:
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.”:
https://www.politepix.com/upgradeguide
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.
December 11, 2014 at 3:37 pm #1023411nrbrookParticipantOk thanks. If I have a static language model do I still require the rejecto plugin in my project which uses that language model?
December 11, 2014 at 3:39 pm #1023412Halle WinklerPolitepixYou’re welcome.
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.
-
AuthorPosts
- You must be logged in to reply to this topic.