[Resolved] Language mode generator + rejecto not working

Home Forums OpenEars plugins [Resolved] Language mode generator + rejecto not working

Tagged: 

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

  • Author
    Posts
  • #1023407
    nrbrook
    Participant

    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.

    #1023409
    nrbrook
    Participant

    Ok, 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)

    #1023410
    Halle Winkler
    Politepix

    This 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.

    #1023411
    nrbrook
    Participant

    Ok thanks. If I have a static language model do I still require the rejecto plugin in my project which uses that language model?

    #1023412
    Halle Winkler
    Politepix

    You’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.

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