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.