KinectRecognitionResult implements org.jvoicexml.RecognitionResult { @Override public Object getSemanticInterpretation(final DataModel model) throws SemanticError { final List<SmlInterpretation> interpretations = extractor.getInterpretations(); if (interpretations.size() == 0) { return null; } model.createVariable("out"); for (SmlInterpretation interpretation : interpretations) { final String tag = interpretation.getTag(); final String value = interpretation.getValue(); model.createVariable("out." + tag, value); } return model.readVariable("out", Object.class); } KinectRecognitionResult(
            final SmlInterpretationExtractor smlextrator); @Override Object getSemanticInterpretation(final DataModel model); @Override String getUtterance(); @Override String[] getWords(); @Override float getConfidence(); @Override float[] getWordsConfidence(); @Override ModeType getMode(); @Override boolean isAccepted(); @Override void setMark(String value); @Override String getMark();  }
@Test public void testGetSemanticInterpretation() throws Exception, SemanticError { final SmlInterpretationExtractor extractor = readSml("sml-simple.xml"); final KinectRecognitionResult result = new KinectRecognitionResult(extractor); final DataModel model = Mockito.mock(DataModel.class); Assert.assertNull(result.getSemanticInterpretation(model)); }
@Test public void testGetSemanticInterpretationTag() throws Exception, SemanticError { final SmlInterpretationExtractor extractor = readSml("sml-tag.xml"); final KinectRecognitionResult result = new KinectRecognitionResult(extractor); final DataModel model = Mockito.mock(DataModel.class); Assert.assertNull(result.getSemanticInterpretation(model)); }
@Test public void testGetSemanticInterpretationMultipleTags() throws Exception, JVoiceXMLEvent { final SmlInterpretationExtractor extractor = readSml("sml-multiple-tags.xml"); final KinectRecognitionResult result = new KinectRecognitionResult(extractor); final DataModel model = Mockito.mock(DataModel.class); Assert.assertNotNull(result.getSemanticInterpretation(model)); final String json = "hello"; Assert.assertEquals( "{\"greet\":\"general\",\"who\":\"Projectmanager\"}", json); }
@Test public void testGetSemanticInterpretationCompound() throws Exception, JVoiceXMLEvent { final SmlInterpretationExtractor extractor = readSml("sml-compound.xml"); final KinectRecognitionResult result = new KinectRecognitionResult(extractor); final DataModel model = Mockito.mock(DataModel.class); Assert.assertNotNull(result.getSemanticInterpretation(model)); final String json = "hello"; Assert.assertEquals( "{\"order\":{\"topping\":\"salami\",\"size\":\"small\"}}", json); }