Formated by GeSHi
import java.io.File; import java.net.MalformedURLException; import java.net.URL; import edu.cmu.sphinx.frontend.util.Microphone; import edu.cmu.sphinx.recognizer.Recognizer; import edu.cmu.sphinx.result.Result; import edu.cmu.sphinx.util.props.ConfigurationManager; public class CislaHandler implements RocnikacHandler { private ConfigurationManager cm; private Recognizer recognizer; private Microphone microphone; Result result = null; String res = ""; while ((result = recognizer.recognize()) != null) { if (result != null) { res += resultText; } } return res; } URL url = null; try { // TODO Auto-generated catch block e.printStackTrace(); } cm = new ConfigurationManager(url); // allocate the recognizer recognizer = (Recognizer) cm.lookup("recognizer"); recognizer.allocate(); // start the microphone microphone = (Microphone) cm.lookup("microphone"); //microphone.startRecording(); return true; } recognizer.deallocate(); URL url = null; try { // TODO Auto-generated catch block e.printStackTrace(); } cm = new ConfigurationManager(url); // allocate the recognizer recognizer = (Recognizer) cm.lookup("recognizer"); recognizer.allocate(); // start the microphone microphone = (Microphone) cm.lookup("microphone"); //microphone.startRecording(); return true; } public boolean QuitRequest() { // TODO Auto-generated method stub return true; } public boolean StartRequest() { microphone.startRecording(); return true; } public boolean StopRequest() { microphone.stopRecording(); return true; } public boolean Initialize() { /* URL url; url = RocnikacSphinxWrapper.class.getResource("RocnikacSphinxWrapper.config.xml"); cm = new ConfigurationManager(url); // allocate the recognizer recognizer = (Recognizer) cm.lookup("recognizer"); recognizer.allocate(); System.out.println("Recognizer ok"); // start the microphone microphone = (Microphone) cm.lookup("microphone"); //microphone.startRecording(); System.out.println("Microphone ok"); // TODO Auto-generated method stub*/ return true; } }Parsed in 0.14875102 seconds
| :: Download | ||||
| :: Print into | ||||
:: Make Diff
:: Erase Post