May Need Previous Version of Rejecto

Home Forums OpenEars plugins May Need Previous Version of Rejecto

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

  • Author
    Posts
  • #1018936
    Lann
    Participant

    Hello,

    I just purchased Rejecto and I am having some linker issues. I believe that I need the previous version of Rejecto for my project. In my case, it would be preferable to use the older Rejecto rather than upgrading OpenEars.

    Here is the linker error I am getting which does not occur when I use the older RejectoDemo.framework:

    Undefined symbols for architecture i386:
    “_OBJC_CLASS_$_SScribe”, referenced from:
    objc-class-ref in Rejecto(LanguageModelGenerator+Rejecto.o)
    ld: symbol(s) not found for architecture i386

    #1018937
    Halle Winkler
    Politepix

    Welcome Lann,

    I completely understand the drive behind the request and I’m sorry since I can’t distribute out-of-date versions. It would be extremely arduous to give any support for since it requires the entire test rig of that era (the OpenEars version, any other plugins, possibly Xcode versions if OS versions were involved with the upgrade) and your account would require special handling every time there was an update. But I’ll be happy to assist you here to get up to the current version of OpenEars; just let me know any issues you’re encountering.

    #1018938
    Lann
    Participant

    Thanks for the quick response. Oddly, the linker error persists even if I use the latest OpenEars. I also get an extra one, just for fun:

    Undefined symbols for architecture i386:
    “_OBJC_CLASS_$_SScribe”, referenced from:
    objc-class-ref in Rejecto(LanguageModelGenerator+Rejecto.o)
    “_returner”, referenced from:
    -[LanguageModelGenerator(Rejecto) generateRejectingLanguageModelFromArray:withFilesNamed:withOptionalExclusions:usingVowelsOnly:withWeight:forAcousticModelAtPath:] in Rejecto(LanguageModelGenerator+Rejecto.o)
    ld: symbol(s) not found for architecture i386

    #1018939
    Lann
    Participant

    Scratch that last one. It was my own mistake. Now it compiles and links but the whole issue here is that I’m using an older version of an Apache Cordoba/PhoneGap plugin for openears and now I get the following error which did not previously occur:

    -[LanguageModelGenerator generateRejectingLanguageModelFromArray:withFilesNamed:withOptionalExclusions:usingVowelsOnly:withWeight:]: unrecognized selector sent to instance 0x8330280

    *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> -[LanguageModelGenerator generateRejectingLanguageModelFromArray:withFilesNamed:withOptionalExclusions:usingVowelsOnly:withWeight:]: unrecognized selector sent to instance 0x8330280

    #1018940
    Halle Winkler
    Politepix

    Oh, great to hear (I had just written up a big troubleshooting process for you but it sounds like you’re OK as far as the framework). The issue above is just because OpenEars and Rejecto had an API change in order to support multiple languages, with the addition of an AcousticModel object whose path needs to be passed to LanguageModelGenerator and PocketsphinxController methods now. Just take a look at the replacement for the complaining method above that is in the header file or PDF. The tutorial also uses the current API so it might be worth a look.

    #1018941
    Lann
    Participant

    I am still having a bit of trouble converting the following snippet:

    -(void)languageModelGeneratorGenerateLanguageModelFromArray:(NSArray *)arguments withDict:(NSDictionary *)options{

    NSString *languageArrayCSV = [arguments objectAtIndex:0];
    NSArray *languageArray = [languageArrayCSV componentsSeparatedByString:@”,”];

    NSError *error = [self.language_model_generator generateRejectingLanguageModelFromArray:languageArray withFilesNamed:@”dynamic”withOptionalExclusions:nil
    usingVowelsOnly:FALSE
    withWeight:nil];

    I am trying:

    NSError *error = [self.language_model_generator generateRejectingLanguageModelFromArray:languageArray
    withFilesNamed:@”dynamic”
    withOptionalExclusions:nil
    usingVowelsOnly:FALSE
    withWeight:nil
    // Change “AcousticModelEnglish” to “AcousticModelSpanish” to create a Spanish Rejecto model.
    forAcousticModelAtPath:[AcousticModel pathToModel:@”AcousticModelEnglish”]];

    But I get an error that AcousticModel is undefined

    #1018943
    Lann
    Participant

    Well, I seem to have gotten past the above issue and now i’m at:

    Error: the default phonetic dictionary (null) can’t be found in the app bundle but the app is attempting to access it, most likely there will be a crash now.

    #1018944
    Halle Winkler
    Politepix

    Progress, progress :) . Is it possible that you haven’t added the acoustic model bundle itself to your app so that it is available at the root of mainBundle?

    #1018945
    Lann
    Participant

    I have AcousticModelEnglish.bundle in the root of my Resources folder in xcode. What else could this be?

    #1018946
    Halle Winkler
    Politepix

    The important question is about whether it is found in the root level of your app and whether all of its files are within. You can verify this by going to your Products folder, right-clicking on the built app, choosing “Show In Finder”, and then right-clicking on the .app file and selecting “Show Package Contents”. You should then see all the items at the root level of your app, and the acoustic model bundle should be there. If you look inside it, it should have the same files within as it does in the distribution.

    #1018947
    Lann
    Participant

    The bundle is making it to the product so it’s not that. I am somewhat stumped now. Here are the functions from my plugin which call the updated code

    /*
    * ++++++++++++++++++++++++++++++++++++++++
    * LanguageModelGenerator methods
    * ++++++++++++++++++++++++++++++++++++++++
    */
    -(void)languageModelGeneratorGenerateLanguageModelFromArray:(NSArray *)arguments withDict:(NSDictionary *)options{

    NSString *languageArrayCSV = [arguments objectAtIndex:0];
    NSArray *languageArray = [languageArrayCSV componentsSeparatedByString:@”,”];

    /*NSError *error = [self.language_model_generator generateRejectingLanguageModelFromArray:languageArray withFilesNamed:@”dynamic”withOptionalExclusions:nil
    usingVowelsOnly:FALSE
    withWeight:nil];*/

    NSError *error = [self.language_model_generator generateRejectingLanguageModelFromArray:languageArray
    withFilesNamed:@”dynamic”
    withOptionalExclusions:nil
    usingVowelsOnly:FALSE
    withWeight:nil
    // Change “AcousticModelEnglish” to “AcousticModelSpanish” to create a Spanish Rejecto model.
    forAcousticModelAtPath:[self.current_language_model 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);

    self.path_to_dynamic_language_model = lmPath;
    self.path_to_dynamic_grammar = dictionaryPath;

    }
    //[languageArray release];
    if(dynamicLanguageGenerationResultsDictionary){
    NSLog(@”LANGUAGE MODEL PATH: %@”,self.path_to_dynamic_language_model);
    NSLog(@”DYNAMIC GRAMMAR PATH: %@”,self.path_to_dynamic_grammar);

    switch ([self.started_listening intValue]) {

    // Pocketsphinx is listening, switch to new language model
    case 1:
    NSLog(@”***Switching to new lm.”);
    [self.pocket_sphinx_controller changeLanguageModelToFile:self.path_to_dynamic_language_model withDictionary:self.path_to_dynamic_grammar];
    break;

    // Otherwise, start listening with language model
    default:
    NSLog(@”***Starting with new lm.”);
    //[self.pocket_sphinx_controller startListeningWithLanguageModelAtPath:self.path_to_dynamic_language_model dictionaryAtPath:self.path_to_dynamic_grammar languageModelIsJSGF:NO];
    [self.pocket_sphinx_controller startListeningWithLanguageModelAtPath:self.path_to_dynamic_language_model dictionaryAtPath:self.path_to_dynamic_grammar acousticModelAtPath:[self.current_language_model pathToModel:@”AcousticModelEnglish”] languageModelIsJSGF:NO]; // Change “AcousticModelEnglish” to “AcousticModelSpanish” to perform Spanish recognition instead of English.
    break;
    }

    }

    }

    /*
    * ++++++++++++++++++++++++++++++++++++++++
    * LanguageModelGenerator methods
    * ++++++++++++++++++++++++++++++++++++++++
    */
    -(void)languageModelGeneratorGenerateLanguageModelFromArray:(NSArray *)arguments withDict:(NSDictionary *)options{

    NSString *languageArrayCSV = [arguments objectAtIndex:0];
    NSArray *languageArray = [languageArrayCSV componentsSeparatedByString:@”,”];

    /*NSError *error = [self.language_model_generator generateRejectingLanguageModelFromArray:languageArray withFilesNamed:@”dynamic”withOptionalExclusions:nil
    usingVowelsOnly:FALSE
    withWeight:nil];*/

    NSError *error = [self.language_model_generator generateRejectingLanguageModelFromArray:languageArray
    withFilesNamed:@”dynamic”
    withOptionalExclusions:nil
    usingVowelsOnly:FALSE
    withWeight:nil
    // Change “AcousticModelEnglish” to “AcousticModelSpanish” to create a Spanish Rejecto model.
    forAcousticModelAtPath:[self.current_language_model 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);

    self.path_to_dynamic_language_model = lmPath;
    self.path_to_dynamic_grammar = dictionaryPath;

    }
    //[languageArray release];
    if(dynamicLanguageGenerationResultsDictionary){
    NSLog(@”LANGUAGE MODEL PATH: %@”,self.path_to_dynamic_language_model);
    NSLog(@”DYNAMIC GRAMMAR PATH: %@”,self.path_to_dynamic_grammar);

    switch ([self.started_listening intValue]) {

    // Pocketsphinx is listening, switch to new language model
    case 1:
    NSLog(@”***Switching to new lm.”);
    [self.pocket_sphinx_controller changeLanguageModelToFile:self.path_to_dynamic_language_model withDictionary:self.path_to_dynamic_grammar];
    break;

    // Otherwise, start listening with language model
    default:
    NSLog(@”***Starting with new lm.”);
    //[self.pocket_sphinx_controller startListeningWithLanguageModelAtPath:self.path_to_dynamic_language_model dictionaryAtPath:self.path_to_dynamic_grammar languageModelIsJSGF:NO];
    [self.pocket_sphinx_controller startListeningWithLanguageModelAtPath:self.path_to_dynamic_language_model dictionaryAtPath:self.path_to_dynamic_grammar acousticModelAtPath:[self.current_language_model pathToModel:@”AcousticModelEnglish”] languageModelIsJSGF:NO]; // Change “AcousticModelEnglish” to “AcousticModelSpanish” to perform Spanish recognition instead of English.
    break;
    }

    }

    }

    #1018948
    Lann
    Participant

    Here is the full error that I’m receiving:

    Error while trying to load the pronunciation dictionary: Error Domain=NSCocoaErrorDomain Code=260 “The operation couldn’t be completed. (Cocoa error 260.)” UserInfo=0x83480d0 {NSFilePath=(null)/LanguageModelGeneratorLookupList.text, NSUnderlyingError=0x835c9b0 “The operation couldn’t be completed. No such file or directory”}

    #1018949
    Halle Winkler
    Politepix

    I think this is not a path to an acoustic model and also that it is null when it is passed: [self.current_language_model pathToModel:@”AcousticModelEnglish”]]; Take a look at the tutorial for an example of a path to the acoustic model.

    #1018953
    Lann
    Participant

    I am still quite stumped at the moment. Maybe you could take a look at the code I am basing all of this on here:

    https://github.com/rtelep/phonegap_openears/blob/master/openEarsPlugin.mm

    Does the issue have something to do with self.current_language_model being an NSString?

    #1018955
    Halle Winkler
    Politepix

    Give it a try using the version from the tutorial/docs:

    [AcousticModel pathToModel:@”AcousticModelEnglish”]

    #1018956
    Lann
    Participant

    Aaaand it works! Thank you so much for your help. The issue was that I forgot to include

    #import <OpenEars/AcousticModel.h>

    #1018957
    Halle Winkler
    Politepix

    That’s great! You’re welcome.

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