Home › Forums › OpenEars › Mixing JSGF and default using changeLanguageModelToFile › Reply To: Mixing JSGF and default using changeLanguageModelToFile
I got your minimal replication case to crash:
remove firstLanguageArray and secondLanguageArray
instead declare them both as NSDictionaries:
NSDictionary *firstLanguageDictionary = @{
ThisWillBeSaidOnce : @[
@{ OneOfTheseCanBeSaidWithOptionalRepetitions : @[
@"BACKWARD",
@"CHANGE",
@"FORWARD",
@"GO",
@"LEFT",
@"MODEL",
@"RIGHT",
@"TURN"]}
]
};
...
NSDictionary *secondLanguageDictionary = @{
ThisWillBeSaidOnce : @[
@{ OneOfTheseCanBeSaidWithOptionalRepetitions : @[
@"SUNDAY",
@"MONDAY",
@"TUESDAY",
@"WEDNESDAY",
@"THURSDAY",
@"FRIDAY",
@"SATURDAY",
@"QUIDNUNC",
@"CHANGE MODEL"]}
]
};
The languageModelGenerator calls become:
NSError *error = [languageModelGenerator generateGrammarFromDictionary:firstLanguageDictionary withFilesNamed:@"FirstOpenEarsDynamicLanguageModel" forAcousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"]];
...
error = [languageModelGenerator generateGrammarFromDictionary:secondLanguageDictionary withFilesNamed:@"SecondOpenEarsDynamicLanguageModel" forAcousticModelAtPath:[OEAcousticModel pathToModel:@"AcousticModelEnglish"]];
The dictionary path assignments become:
self.pathToFirstDynamicallyGeneratedLanguageModel = [languageModelGenerator pathToSuccessfullyGeneratedGrammarWithRequestedName:@"FirstOpenEarsDynamicLanguageModel"];
...
self.pathToSecondDynamicallyGeneratedLanguageModel = [languageModelGenerator pathToSuccessfullyGeneratedGrammarWithRequestedName:@"SecondOpenEarsDynamicLanguageModel"];
Now run the app and say a few words to prove it’s working.
Next say “CHANGE MODEL”
My version crashes (on another thread) while executing this line:
[self.fliteController say:[NSString stringWithFormat:@"You said %@",hypothesis] withVoice:self.slt];
here’s the backtrace:
(lldb) bt
* thread #10: tid = 0x209f8, 0x000000010008322c OpenEarsSampleApp`
fsg_lextree_init + 516, queue = ‘com.apple.root.default-qos’, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x000000010008322c OpenEarsSampleApp`fsg_lextree_init + 516
frame #1: 0x0000000100047ef0 OpenEarsSampleApp`fsg_search_reinit + 92
frame #2: 0x000000010001a968 OpenEarsSampleApp`ps_load_dict + 364
frame #3: 0x000000010002e37c OpenEarsSampleApp`usenglish_init + 7008
frame #4: 0x000000010002d16c OpenEarsSampleApp`usenglish_init + 2384
frame #5: 0x000000010002cda8 OpenEarsSampleApp`usenglish_init + 1420
frame #6: 0x0000000100670f94 libdispatch.dylib`_dispatch_client_callout + 16
frame #7: 0x0000000100688848 libdispatch.dylib`_dispatch_source_latch_and_call + 1392
frame #8: 0x00000001006731c0 libdispatch.dylib`_dispatch_source_invoke + 292
frame #9: 0x000000010067e5d4 libdispatch.dylib`_dispatch_root_queue_drain + 772
frame #10: 0x0000000100680248 libdispatch.dylib`_dispatch_worker_thread3 + 132
frame #11: 0x0000000194f2522c libsystem_pthread.dylib`_pthread_wqthread + 816
</blockquote>The fatal call was this one:
[[OEPocketsphinxController sharedInstance] changeLanguageModelToFile:self.pathToSecondDynamicallyGeneratedLanguageModel withDictionary:self.pathToSecondDynamicallyGeneratedDictionary];
Please let me know if you are unable to replicate. Happens for me every time.
-Erick