Cloudgarden's Discussion Board
Forums: Search: Several forums are available for people to post questions/comments about Java Speech or any of the CloudGarden products. As more messages are posted this discussion board should provide a useful, searchable, support database.
o AliceTalker (42)
o JSAPI Projects (69)
o Java Speech API (857)
o Jigloo GUI Builder for Eclipse (3322)
o SwingScroller (0)
o US Election 2004 (3)
Searches text and subject fields in all forums. The search matches as many words as possible. Don't use "AND" or "OR".
Latest "Java Speech API" Topics [ Start new "Java Speech API" Topic  ]

Cloudgarden Discussion Board  
This topic has 1 reply.       [ << Previous Topic | Start of Thread | >> Next Topic ]
Loading multiple grammars
Author: MartinNyolt
06/29/11 08:39 Reply
Hello,

the following code produces only one RuleGrammar instance:


Recognizer rec; <init ...>
RuleGrammar gram1 = rec.loadJSGF(new URL(baseURL), grammarName1);
RuleGrammar gram2 = rec.loadJSGF(new URL(baseURL), grammarName2);


But gram1 and gram2 are the same object, and the rules of gram1 are overwritten by the rules of gram2.
Why is this? (Also commiting changed before loading the seconds grammar does not help)

Here's the code how I initialize the recognizer (omitting exception handling):


EngineModeDesc desc = new EngineModeDesc(Locale.GERMANY);
rec = Central.createRecognizer(desc);

rec.allocate();
rec.waitEngineState(Engine.ALLOCATED);

RecognizerProperties props = rec.getRecognizerProperties();
props.setIncompleteTimeout(2);
props.setNumResultAlternatives(3);
props.setResultAudioProvided(true);
props.setConfidenceLevel(0.8f);
props.setSpeedVsAccuracy(1f);

rec.requestFocus();
rec.resume();
rec.waitEngineState(Engine.RESUMED);

Re: Loading multiple grammars
Author:MartinNyolt
Reply 1 of 106/29/11 08:45Reply
I'm using the version 1.7.0 of cgjsapi