1 Reply Latest reply on Dec 30, 2008 2:57 PM by 800370

    how I can catch the word that was spoken in a string??

      i'm doing a java aplication with speech recognition jsapi and i want know how  i can convert tag form FinalRuleResult  to string??

      i want  catch the word that was spoken in a string to  evaluate the string in the sentences if                               

      this is the code that i have developed:

      public static void main(String[] args)
           {prueba inst = new prueba();
                try {
                     RecognizerModeDesc descripcion = new RecognizerModeDesc(null, Boolean.TRUE);
                     SpeechEngineChooser chooser = SpeechEngineChooser.getRecognizerDialog(descripcion);
                     descripcion = chooser.getRecognizerModeDesc();
                     reconocedor = Central.createRecognizer(descripcion);
                     reconocedor.addEngineListener(new TestEngineListener());
                     RecognizerAudioAdapter raud = new TestAudioListener();
                     RuleSequence secuencia = new RuleSequence();
                     RuleTag comando1 = new RuleTag(new RuleToken("vol"),"VOL");
                     RuleTag comando2 = new RuleTag(new RuleToken("channel"),"CHANNEL");
                     RuleTag comando3 = new RuleTag(new RuleToken("end"),"END");
                     RuleTag comando4 = new RuleTag(new RuleToken("up"),"UP");
                     RuleTag comando5 = new RuleTag(new RuleToken("down"),"DOWN");
                     RuleAlternatives comandos = new RuleAlternatives();
                     RuleGrammar gramatica = reconocedor.newRuleGrammar("basepatrones");
                     reconocedor.addResultListener(new ResultAdapter() {
                          public void resultAccepted(final ResultEvent e)
                               try {
                                    FinalRuleResult r = (FinalRuleResult)(e.getSource());
                                    System.out.println("Obtenido el resultado "+r);
                                    String tags[] = r.getTags();
      if(tags == null) return;
                          //comparacion de :::     
      // in this point i want catch the word that was spoken in a string to evaluate the string in the sentences if                               
                                         JOptionPane.showMessageDialog(null,"has selecciuonado el volumen");
                                         jLabel1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("control/controltv+.gif")));
                                              JOptionPane.showMessageDialog(null,"QUIERES CAMBIAR CANAL???");
                                              jLabel1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("control/controlt0.gif")));
                                    JOptionPane.showMessageDialog(null,"SESION DE RECONOCIMIENTO TERMINADA");
                                    jLabel1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("control/controlt1.gif")));
                                    else return;
                               } catch(Exception e1) {}
                } catch (Exception e) {
                     System.exit(-1); }