Is it possible in sphinx 4 to recognize all possible words
No, it's not possible. Every speech recognizer including the one from Google uses limited vocabulary. Google uses large one of about 1.5 million words but still limited. So CMUSphinx. You can verify that by trying to recognize rare proper names, it's almost impossible even with Google.
The practical solution is to use large language model with large vocabulary.
It's a open research question to detect new words in an audio stream and add them recognizer with spoken or other type of feedback.
Pocketsphinx - Adding words and Improving accuracy
With something like this, you can't be certain, but I can offer the following suggestions:
Perhaps the language model somehow has low probabilities for "spaghetti" and "pencil". As you suggested, you could use a JSGF to test out how it does for recognition if it doesn't use the N-gram models, but instead does a simple grammar (give it like twenty words, including spaghetti and pencil). This way you can see if it is perhaps the language model which makes it difficult to recognize these words, and it can do okay if it considers all the words to have equal probability.
Perhaps you simply pronounce these words poorly, even with the alternative dictionary entries. Try either A. Testing other peoples' voices, or B. Adapting the acoustic model to your voice (see http://cmusphinx.sourceforge.net/wiki/tutorialam)
Also, what is it recognizing them as when it is failing? If possible, remove the words it misrecognizes as from the dictionary.
Again, for overall accuracy, only three things are going to really help you: restricting the grammar, adapting the accoustic model, and perhaps getting higher quality recording input.
CMU PocketSphinx Recognize a dynamically entered word
You can add and delete keyword search any time, something like this:
private static final String SEARCH_NAME = "kws";
/* Word you want to check */
public void recognizeWord(String word ) {
recognizer.setKeyphrase(SEARCH_NAME, word);
recognizer.setSearch(SEARCH_NAME);
recognizer.startListening(SEARCH_NAME);
}
How to see if word exists in Pocketsphinx dictionary?
In C there is ps_lookup_word function which allows you to lookup for the word:
if (ps_lookup_word(ps, "abc") == NULL) {
// do something
}
In Java wrapper it's a method Decoder.lookupWord
:
if(decoder.lookupWord("abc") == null) {
// do something
}
In Android, you can access decoder from Recognizer
:
if(recognizer.getDecoder().lookupWord("abc") == null) {
// do something
}
Related Topics
Android Studio - Creating Modules Without Copying Files
Finish Parent and Current Activity in Android
Custom Uri Schemes for the Facebook Messenger
Run Code Only Once After an Application Is Installed on Android Device
Customize Check Box Preference
Videoview Getdrawingcache Is Returning Black
Why a New Viewmodel Is Created in Each Compose Navigation Route
Detecting Which Selected Item (In a Listview) Spawned the Contextmenu (Android)
How to Get the Current Location in Google Maps Android API V2
Textinputlayout Not Showing Edittext Hint Before User Focus on It
List All the Files from All the Folder in a Single List
How to Cancel an Dialog Themed Like Activity When Touched Outside the Window
How to Get the Google Username on Android
Popupwindow $Badtokenexception: Unable to Add Window -- Token Null Is Not Valid
Rotating a Bitmap Using Jni & Ndk
How to Obtain All Details of a Contact in Android