Forum Replies Created
-
AuthorPosts
-
November 27, 2013 at 2:23 pm in reply to: After first recognition failure, all successive attempts fail #1019031LannParticipant
Ah, understood. This was quite difficult to figure out for me. I based my project on an older PhoneGap plugin for Openears that was on Github which is doing exactly what caused this problem. I think they are unaware of this limitation.
November 27, 2013 at 11:14 am in reply to: After first recognition failure, all successive attempts fail #1019029LannParticipantSo, after further investigation I believe that this was related to reusing the same .dmp/.dic file multiple times. I have seen another forum post where the user reccommended alternating dictionary files but this does not resolve the issue.
The only thing resolving it for me is to use a new filename each time. How can I work around this because I’m making a game where this would result in hundreds of files.
To offer a little more potential insight into how this may have worked for the other user, it also seems to work if I alternate between dictionaries but ONLY as long as they never change their contents. Once a word changes then that dictionary becomes corrupt if I attempt to reuse it.
November 27, 2013 at 6:25 am in reply to: How to Initially set language model without listening? #1019023LannParticipantOh, maybe the issue is that I’m using startListeningWithLanguageModelAtPath every time I change the language model. Shouldn’t I be using changeLanguageModelToFile on successive calls?
November 27, 2013 at 12:16 am in reply to: How to Initially set language model without listening? #1019019LannParticipantMy logs show that it takes 4 seconds to execute the following statement on an iPhone 4S:
[self.pocket_sphinx_controller startListeningWithLanguageModelAtPath:self.path_to_dynamic_language_model dictionaryAtPath:self.path_to_dynamic_grammar acousticModelAtPath:[AcousticModel pathToModel:@”AcousticModelEnglish”] languageModelIsJSGF:NO];
Here is how the language model was earlier initialized (if this is relevant):
NSError *error = [self.language_model_generator generateRejectingLanguageModelFromArray:languageArray
withFilesNamed:@”dynamic”
withOptionalExclusions:nil
usingVowelsOnly:FALSE
withWeight:nil
forAcousticModelAtPath:[AcousticModel pathToModel:@”AcousticModelEnglish”]];[self.language_model_generator deliverRejectedSpeechInHypotheses:TRUE];
November 26, 2013 at 4:55 pm in reply to: After first recognition failure, all successive attempts fail #1019010LannParticipantOk…it seems to only happen in the iOS 6.x simulator. No more simulator for me ever.
LannParticipantThanks! That worked for me.
LannParticipantAaaand it works! Thank you so much for your help. The issue was that I forgot to include
#import <OpenEars/AcousticModel.h>
LannParticipantI 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?
LannParticipantHere 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”}
LannParticipantThe 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;
}}
}
LannParticipantI have AcousticModelEnglish.bundle in the root of my Resources folder in xcode. What else could this be?
LannParticipantWell, 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.
LannParticipantI 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
LannParticipantScratch 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
LannParticipantThanks 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 i386LannParticipantWhen attempting to link the SaveThatWaveDemo I get the following linker error:
“_input_sample_rate”, referenced from:
-[SaveThatWaveController bufferIsAvailable:] in SaveThatWaveDemo(SaveThatWaveController.o)
-[SaveThatWaveController pocketsphinxDidDetectFinishedSpeech] in SaveThatWaveDemo(SaveThatWaveController.o)This seems to be a valid error since the variable in OpenEars 1.2.4 is actually called “input_sample_rate”.
Could you please provide a new binary for SaveThatWaveController.o?
LannParticipantHalle, it does, and you are a sexy man! This is exactly what i was looking for. I am getting an error during installation that pocketsphinxController.outputAudio is undefined. I’m not sure how to tell which version of OpenEars i’m running. This may be a huge problem for me because I have somewhat heavily modified OpenEars for my project and it may have been based on a version that does not have this method.
-
AuthorPosts