3

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!

Rukshan Hassim
  • 505
  • 6
  • 15
  • Are the characters recognized as words? Like `ay` `bee` `see` `dee` `e` `eff` `gee` – ManIkWeet Jun 14 '16 at 14:08
  • @ManIkWeet **Y** is recognized as **why** but most of the others are not recognized at all. The google response is null 90% of the time with characters. – Rukshan Hassim Jun 14 '16 at 14:13
  • Other voice recognition software I've used has required some sort of prefix if you want to say letters. For example, "Spell A" would type the letter 'A'. "Spell ABC" would type 'ABC'. Is it possible to treat your input differently depending on the previous sound? – AWT Jun 14 '16 at 14:29
  • @AWT I can try doing this. But before that I will check whether the google speech api is capable of handling things itself. Thanks! – Rukshan Hassim Jun 14 '16 at 14:35
  • @AWT no luck on that, google speech fails to identify characters like 'A' individually – Rukshan Hassim Jun 14 '16 at 15:27

1 Answers1

1

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

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • I tried this code and I keep getting some exceptions @Nikolay Shmyrev! What i did was i used this exact code and made a directory in my project root as "grammars_folder" and made a letters.gram with the lines you provided. What could I be doing wrong? I get these errors 'java.lang.RuntimeException: Allocation of search manager resources failed, java.io.IOException: edu.cmu.sphinx.jsgf.JSGFGrammarParseException edu.cmu.sphinx.jsgf.JSGFGrammarParseException' – Rukshan Hassim Jun 18 '16 at 08:28
  • Provide full stacktrace. Also provide the grammar file you wrote, most likely you made a typo in it. – Nikolay Shmyrev Jun 18 '16 at 18:35