Java Speech Development Kit: A Tutorial
The voice recognition is based upon a set of words (phonemes) named grammars. A created recognizer can have associated grammars, increasing its recognition domain according to the application needs. Having associated grammars, the recognizers generate result objects as answers to the recognition process. These results contain information about what was understood. This information is made available through ResultEvents fired by the results and caught by ResultListener, where the implementation determines what to do with the recognized data.
To implement this schema the recognizer can have two types of associated grammars, each one of them with its own word domain. They have distinct size and elements and determine a different recognition process:
Dictation grammars: these grammars are comprised of sets of words with thousands of elements. Their elements are determined by the function of their comprised domain, such as medicine, computer science or engineering. A general purpose grammar is available with the development kit.
Dictation grammars analyze the context of what is being spoken and try to limit the set of words that can be said next. Their use is specific to continuous dictating speech, such as texts and sentences. Great processing capacity is needed, therefore, and its use requires well projected applications.
The creation of a dictation grammar is done through a recognizer that supports its use. It is illustrated in here:
DictationGrammar dictationGrammar = recognizer.getDictationGrammar(null); dictationGrammar.setEnabled(true);Rule grammars: these are simpler than dictation grammars. They are comprised of rules that determine what can be said and how it will be represented inside the application. The rules are defined in a special format named JSGF (Java Speech Grammar Format) and can be loaded one at a time or many at once during execution.
Rule grammars require less processing capacity than dictation grammars and its recognition accuracy is much higher, resulting in a bigger number of accepted results. This is possible because of their limited scope of recognition. It is a grammar well suited for voice-command definitions, determining a specific set of commands for the various contexts of an application.
There are two ways to create a rule grammar:
through the loadJSGF method, when a set of rules is loaded from a text file; or
through the newRuleGrammar method, which returns an empty rule grammar that must be specified during execution.
Both methods belong to the recognizer interface, being the grammar automatically associated with the recognizer that created it.
The speech recognition systems make it possible for the computer to hear what a user says and "understand" what was spoken. Speech for Java does not yet support speech recognition without restrictions; the ability to hear any speech in any context and understand it accurately. To reach a reasonable accuracy and answer time, the recognition limits what might be said through the use of grammars, as seen in the previous section. The Java Speech Grammar Format (JSGF) language defines a way to describe what is named as a RuleGrammar. It uses a textual representation that might be read and edited by both developers and users through a simple text editor.
The rules have the following structure:
If something is said and the recognition is not above a confidence level--defined through the use of the method setConfidenceLevel (the default is de 0.5)--a resultRejected rejection event will be triggered. Otherwise a resultAccepted event is created, and the method getTags returns the identifier(s) of the correspondent rule. Table 3 shows the main JSGF features:
Table 3. Main Uses of the JSGF Language
Use | Example | What Might Be Said | |
Simple words | <rule1> = open {open}; | "open" | |
Whole phrases | <rule2> = open the program {open}; | "open the program" | |
Multiple choices | <rule3> = open| open the program {open}; | "open" or "open the program" | |
Optional words | <rule5> = [please] open {open}; | "open" or "please open" | |
Rule referencing | <rule6> = <regra5> {open}; | The same as rule 5 | |
Enclosing operator * | <rule7> = 13579* times; | "1", "3", "5", "7", "9", "11", "13", "99", "93", or another number (including none) formed by 1, 3, 5, 7 and 9 in any order followed by times | |
Enclosing operator + | <rule8> = 13579+ times; | This time a number must be said following the pattern seen in rule7 |
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- RSS Feeds
- Readers' Choice Awards
- Tech Tip: Really Simple HTTP Server with Python
- BASH script to log IPs on public web server
48 min 16 sec ago - DynDNS
4 hours 24 min ago - Reply to comment | Linux Journal
4 hours 56 min ago - All the articles you talked
7 hours 20 min ago - All the articles you talked
7 hours 23 min ago - All the articles you talked
7 hours 24 min ago - myip
11 hours 49 min ago - Keeping track of IP address
13 hours 40 min ago - Roll your own dynamic dns
18 hours 53 min ago - Please correct the URL for Salt Stack's web site
22 hours 5 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Reference Links are Dead
hi there
this is a very nice article. i really liked it and i planned to implement this in my project but unfortunately all the references links are dead.
kindly help me out . u can reach me at gobicse@gmail.com....
any help will be of great help..
thanks
Reference Links are Dead
hi there
this is a very nice article. i really liked it and i planned to implement this in my project but unfortunately all the references links are dead.
kindly help me out . u can reach me at gobicse@gmail.com....
any help will be of great help..
thanks
This is really useful. I
This is really useful. I successfully completed my project voice controlled wheel chair with the help of this concept... It works well....
Re: Java Speech Development Kit: A Tutorial
Is there lib to use text to speak in portuguese language ?
Re: Java Speech Development Kit: A Tutorial
i have read your tutorial about the Java Speech Development Kit, it is truely very interesting, i would realy love to develop a programe of my own on this context. please help me im a graduate from the University of Botswana in Computer Science in Botswana, i realy ineterested in speech program but i dont know where to start and what i need. more especialy that i dont have any of the classies that i can use for statup training plz give me an advice.
my Email is matikitim2@yahoo.cu.com
thank you in advace
Moathodi Excellent Matikiti
Re: Java Speech Development Kit: A Tutorial
I am in the same situation as Moathodi, were I would like to develope a program on this subject. I would really appreciate it if you could aid me in kicking it of as I am not sure were to start.
My email is adil_rehman@hotmail.com
Many Thanks
Adil
Speech recognition engines
I have done a lot of research on the speech development architecture of java..but i am more interested in some package that might make the development of a speech to text application faster. Thanx...hope i get a reply...my emaill is mario_ramotar@yahoo.com