I have a code for speech recognition but it not work good
it has a problem in line 31
what is the solution ???
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;
import edu.cmu.sphinx.util.props.PropertyException;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
public class HelloWorld {
public static void main(String[] args) throws MalformedURLException, IOException, PropertyException, InstantiationException {
URL myURL = new URL("http://purple.com/");
try {
// if (args.length > 0)
// {
// myURL = new File(args[0]).toURI().toURL();
// }
//else {
// myURL = new URL("http:\\www.google.com");
// }
System.out.println("Loading...");
ConfigurationManager cm = new ConfigurationManager(new URL("http:\\www.google.com"));
Recognizer recognizer = (Recognizer) cm.lookup("recognizer");
Microphone microphone = (Microphone) cm.lookup("microphone");
/* allocate the resource necessary for the recognizer */
recognizer.allocate();
/* the microphone will keep recording until the program exits */
if (microphone.startRecording())
{
System.out.println("Say: (Command | Hello)");
while (true)
{
System.out.println
("Start speaking. Press Ctrl-C to quit.\n");
/*
* This method will return when the end of speech
* is reached. Note that the endpointer will determine
* the end of speech.
*/
Result result = recognizer.recognize();
if (result != null)
{
String resultText = result.getBestFinalResultNoFiller();
System.out.println("You said: " + resultText + "\n");
if(resultText.equalsIgnoreCase("command"));
{
Process p;
p = Runtime.getRuntime().exec("cmd /c start");
}
}
else
{
System.out.println("I can't hear what you said.\n");
}
}
}
else
{
System.out.println("Cannot start microphone.");
recognizer.deallocate();
System.exit(1);
}
}
catch (IOException e)
{
System.err.println("Problem when loading HelloWorld: " + e);
}
catch (PropertyException e)
{
System.err.println("Problem configuring HelloWorld: " + e);
}
catch (InstantiationException e) {
System.err.println("Problem creating HelloWorld: " + e);
}
}
}