Results 1 to 2 of 2
Thread: Speech To Text
- 03-22-2011, 11:03 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 51
- Rep Power
- 0
Speech To Text
I have a code and i had defined the grammar files..But still get the text when i speak the words defined in the grammer what might be the problem
Java Code://package com.sarf.talkingjava; import javax.speech.Central; import javax.speech.recognition.*; import java.io.FileReader; import java.util.Locale; public class SpeechToTextConverter extends ResultAdapter { static Recognizer recognizer; //Receives RESULT_ACCEPTED event: print it public void resultAccepted(ResultEvent resultEvent) { Result result = (Result)(resultEvent.getSource()); ResultToken resultToken[] = result.getBestTokens(); for (int nIndex = 0; nIndex < resultToken.length; nIndex++){ System.out.print(resultToken[nIndex].getSpokenText() + " "); } try { // Deallocate the recognizer recognizer.forceFinalize(true); recognizer.deallocate(); }catch (Exception exception) { exception.printStackTrace(); } System.exit(0); } public static void main(String args[]) { try { Central.registerEngineCentral ("com.cloudgarden.speech.CGEngineCentral"); RecognizerModeDesc desc = new RecognizerModeDesc(Locale.US,Boolean.TRUE); // Create a recognizer that supports US English. recognizer = Central.createRecognizer(desc); // Start up the recognizer recognizer.allocate(); // Load the grammar from a file, and enable it FileReader fileReader = new FileReader("C:\\Users\\Priyanka\\Desktop\\my_grammar.grammar"); RuleGrammar grammar = recognizer.loadJSGF(fileReader); grammar.setEnabled(true); // Add the listener to get results // recognizer.addResultListener(new SpeechToTextConverter()); grammar.addResultListener(new SpeechToTextConverter()); // Commit the grammar recognizer.commitChanges(); recognizer.waitEngineState(Recognizer.LISTENING); // Request focus and start listening recognizer.requestFocus(); recognizer.resume(); //System.out.println("working"); recognizer.waitEngineState(Recognizer.FOCUS_ON); recognizer.forceFinalize(true); recognizer.waitEngineState(Recognizer.DEALLOCATED); } catch (Exception e) { e.printStackTrace(); System.exit(0); } } }
The output that i get is nothing its not recognizing the speech that i m giving please help me
- 12-04-2011, 11:44 AM #2
Member
- Join Date
- Dec 2011
- Posts
- 3
- Rep Power
- 0
Re: Speech To Text
Priyanka can u pls help me with the above project....I am really struck with this and i need this very badly as i chose this as my Engineering project....Pls help me..Can u pls expalin me bat the part (Central.registerEngineCentral
("com.cloudgarden.speech.CGEngineCentral");)
in ur project....
Similar Threads
-
speech.properties
By Parneel in forum Advanced JavaReplies: 1Last Post: 12-30-2012, 02:24 PM -
Text To Speech
By jyothi.priyanka in forum Advanced JavaReplies: 0Last Post: 02-24-2011, 05:00 PM -
Speech in Web Application
By vinoopraj in forum Advanced JavaReplies: 0Last Post: 06-23-2010, 11:27 AM -
speech to text concersion
By ak88 in forum Advanced JavaReplies: 1Last Post: 03-09-2010, 08:57 AM -
Capture speech and convert it to text in a textbox
By Cyber Dragon in forum Advanced JavaReplies: 1Last Post: 04-25-2009, 04:55 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks