Solved

Speech Recognition

Posted on 2001-06-05
6
929 Views
Last Modified: 2012-06-27
Hello Guys and Gals

I am trying to create a vary very basic speech recognition application in Java.  Has anyone got any tips, tricks or know of any useful resources that will help me in this area.

I would be grateful for any help.  

Cheers

Rainbow*
0
Comment
Question by:RainbowStar
6 Comments
 
LVL 2

Accepted Solution

by:
mariuso earned 50 total points
ID: 6155549
YOU HAVE TO USE JSAPI.

The following code shows how to create a recognizer, load the grammar, and then wait for the user to say something that matches the grammar. When it gets a match, it deallocates the engine and exits.

--------------------------------------------------------------------------------
import javax.speech.*;
import javax.speech.recognition.*;
import java.io.FileReader;
import java.util.Locale;

public class HelloWorld extends ResultAdapter {
     static Recognizer rec;

     // Receives RESULT_ACCEPTED event: print it, clean up, exit
     public void resultAccepted(ResultEvent e) {
          Result r = (Result)(e.getSource());
          ResultToken tokens[] = r.getBestTokens();

          for (int i = 0; i < tokens.length; i++)
               System.out.print(tokens[i].getSpokenText() + " ");
          System.out.println();

          // Deallocate the recognizer and exit
          rec.deallocate();
          System.exit(0);
     }

     public static void main(String args[]) {
          try {
               // Create a recognizer that supports English.
               rec = Central.createRecognizer(
                                   new EngineModeDesc(Locale.ENGLISH));
               
               // Start up the recognizer
               rec.allocate();
     
               // Load the grammar from a file, and enable it
               FileReader reader = new FileReader(args[0]);
               RuleGrammar gram = rec.loadJSGF(reader);
               gram.setEnabled(true);
     
               // Add the listener to get results
               rec.addResultListener(new HelloWorld());
     
               // Commit the grammar
               rec.commitChanges();
     
               // Request focus and start listening
               rec.requestFocus();
               rec.resume();
          } catch (Exception e) {
               e.printStackTrace();
          }
     }
}


You can try

http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-guide/Recognition.html

or you can try IBM's ViaVoice:
http://www-4.ibm.com/software/speech/dev/hltwp.html
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6155558
Pa unde esti bai sica? Merge sursa aia ?
0
 

Author Comment

by:RainbowStar
ID: 6155590
Cheers thanks for the tips

Would you know how to simply view an applet using a browser.  I have complied the applet using JDK but when I open the applet using browser it shows "class not found"
Can you help ???

Thanks again mariuso
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:mariuso
ID: 6156645
Can be a problem with the case letter of the class. The samples from jdk are working for u ?
0
 

Author Comment

by:RainbowStar
ID: 6156681
The applet works fine using JDK, its just I want to open it using a browser.  I simply open the html code and its not there. I have checked the case letter of the class.
Do you think that it is the classpath ???
0
 

Expert Comment

by:thinkdifferent
ID: 7495116
From where can i dowload javax.speech as this code gives the error package not founf javax.speech
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to parse custom JSON to POJO java 4 55
Exception after setting jdbc session management 2 52
Unexpected HttpURLConnection connection behavior 2 86
oracle 11g 23 49
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now