Solved

Speech Recognition

Posted on 2001-06-05
6
948 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

728 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