Jsapi10RecognitionResult implements RecognitionResult { @Override public Object getSemanticInterpretation(final DataModel model) throws SemanticError { if (interpretation == null) { final FinalRuleResult finalResult = (FinalRuleResult) result; final Object[] objecttags = finalResult.getTags(); if ((objecttags == null) || (objecttags.length == 0)) { return null; } final String[] tags = toString(objecttags); model.createVariable("out"); for (String tag : tags) { if (tag.trim().endsWith(";")) { model.evaluateExpression(tag, Object.class); } else { model.updateVariable("out", tag); } } interpretation = model.readVariable("out", Object.class); final String log = model.toString(interpretation); LOGGER.info("created semantic interpretation '" + log + "'"); } return interpretation; } Jsapi10RecognitionResult(final Result res); @Override String getUtterance(); @Override boolean isAccepted(); @Override void setMark(final String mark); @Override String getMark(); @Override float getConfidence(); @Override float[] getWordsConfidence(); @Override String[] getWords(); @Override ModeType getMode(); @Override Object getSemanticInterpretation(final DataModel model); @Override String toString();  }
@Test public void testGetSemanticInterpretation() throws Exception, SemanticError { final String lf = System.getProperty("line.separator"); final String grammar = "#JSGF V1.0;" + lf + "grammar test;" + lf + "public <test> = a{student.name='horst'}|b|c;"; final StringReader reader = new StringReader(grammar); final RuleGrammar rule = recognizer.loadJSGF(reader); rule.setEnabled(true); }