Rukshan Hassim
Rukshan Hassim

Reputation: 515

Recognizing single characters into java using voice recognition

Is there any implementation in java to capture only characters? Will CMU Sphinx be able to do this? I've been trying with no luck at all. For a fact google speech API does a very poor job out of this. Characters like B,W,X are recognized but almost all the vowels are not! Any information is appreciated. Thanks!

Upvotes: 3

Views: 846

Answers (1)

Nikolay Shmyrev
Nikolay Shmyrev

Reputation: 25220

Write grammar letters.gram like this:

#JSGF V1.0;

grammar letters;

public <letter> = (a. | b. | c. | d. | e. | f. | j.) *;

Use it sphinx4 like this:

Configuration configuration = new Configuration();
configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration.setGrammarPath("file:grammars_folder");
configuration.setGrammarName("letters");
configuration.setUseGrammar(true);

LiveSpeechRecognizer recognizer = new LiveSpeechRecognizer(configuration);
recognizer.startRecognition(true);
SpeechResult result = recognizer.getResult();
recognizer.stopRecognition();

For more details check sphinx4 tutorial

Upvotes: 1

Related Questions