Reply To: Accuracy with just one word in the dictionary

Home Forums OpenEars Accuracy with just one word in the dictionary Reply To: Accuracy with just one word in the dictionary

#1025338
maxgarmar
Participant

Hi Halle,

Trying to create the dictionary with grammar like this:

 NSDictionary *grammar = @{
                                      ThisWillBeSaidOnce : @[
                                              @{ OneOfTheseWillBeSaidOnce : @[@"CREATE A TASK", @"CREATE A TASK FOR", @"TASK FOR"]},
                                              @{ OneOfTheseWillBeSaidOnce : @[@"YURIY", @"JOHN", @"ANN"]},
                                              ]
                                      };
            
            [dictRecognition setObject:array forKey:@"OneOfTheseCanBeSaidOnce"];

            
            //err = [lmGenerator generateLanguageModelFromArray:words withFilesNamed:name forAcousticModelAtPath:[OEAcousticModel pathToModel:voiceLanguage]]; // Change "AcousticModelEnglish" to "AcousticModelSpanish" to create a Spanish language model instead of an English one.
            
             err = [lmGenerator generateGrammarFromDictionary:grammar withFilesNamed:name forAcousticModelAtPath:[OEAcousticModel pathToModel:voiceLanguage]];
            
            
        }
        
        // Call this once before setting properties of the OEPocketsphinxController instance.
        
        
        
        
        if([err code] == noErr) {
            
            
           self.pathToFirstDynamicallyGeneratedLanguageModel = [lmGenerator pathToSuccessfullyGeneratedLanguageModelWithRequestedName:@"NameIWantForMyLanguageModelFiles"];
           self.pathToFirstDynamicallyGeneratedDictionary =  [lmGenerator pathToSuccessfullyGeneratedDictionaryWithRequestedName:@"NameIWantForMyLanguageModelFiles"];
            
            NSLog(@"path1: %@", self.pathToFirstDynamicallyGeneratedLanguageModel);
            
            NSLog(@"path2: %@", self.pathToFirstDynamicallyGeneratedDictionary);
            
            
        } else {
            NSLog(@"Error: %@",[err localizedDescription]);
        }
        
        ///FIN openEars
        
        [self.openEarsEventsObserver setDelegate:self];

        if(![OEPocketsphinxController sharedInstance].isListening){
            
            
            
            [self.pocketsphinxController            startListeningWithLanguageModelAtPath:self.pathToFirstDynamicallyGeneratedLanguageModel dictionaryAtPath:self.pathToFirstDynamicallyGeneratedDictionary acousticModelAtPath:[OEAcousticModel pathToModel:voiceLanguage] languageModelIsJSGF:TRUE];
            
             }

I get this error:

2015-04-07 14:46:13.783 QuickCart[8478:256415] 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.

What am I doing wrong ? I tried also with

languageModelIsJSGF

to

false

but does not help.

Thanks