salhayek

Forum Replies Created

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

  • Author
    Posts
  • salhayek
    Participant

    Thank you so much! You really helped me out! :)

    salhayek
    Participant

    For the unique names, we are talking about the self.lmPath and self.dicPath in regards to the code above right?

    If users were going to change it multiple times in one sitting, should I generate a random string to name the files? If so, I think it would eventually take up space on the device. Or is there a way to clear the files created?

    salhayek
    Participant

    Thank you so much it turns out I just wasn’t calling that method.

    When the user hits submit:

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
                [defaults setObject:alertTextInput forKey:@"commandword"];
                [self loadAppSettings];
                
                NSLog(@"The new command is %@", self.commandWord);
                
                [self LanguageGenerator];
                [pocketsphinxController changeLanguageModelToFile:self.lmPath withDictionary:self.dicPath];

    In the language generator method:

    LanguageModelGenerator *lmGenerator = [[LanguageModelGenerator alloc] init];
        
        self.wordList = [NSArray arrayWithObjects:
                            self.commandWord,
                            nil];
        
        NSError *err = [lmGenerator generateLanguageModelFromArray:self.wordList withFilesNamed:@"LanguageModelFile" forAcousticModelAtPath:[AcousticModel pathToModel:@"AcousticModelEnglish"]];
        
        
        self.languageGeneratorResults = nil;
        self.lmPath = nil;
        self.dicPath = nil;
        
        if([err code] == noErr) {
            
            self.languageGeneratorResults = [err userInfo];
            
            self.lmPath = [self.languageGeneratorResults objectForKey:@"LMPath"];
            self.dicPath = [self.languageGeneratorResults objectForKey:@"DictionaryPath"];
            
        } else {
            NSLog(@"Error: %@",[err localizedDescription]);
        }
    }
    

    So it works now but only the first time I do it. If I try to go and change it again, it won’t recognize the word. I was reading somewhere on the forums that the names of the paths have to be unique, does this apply here?

    Thanks again for the help, you are definitely a life saver.

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