Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pocketshinx - add new words on language model on the fly #39

Open
1Caxz opened this issue Jan 16, 2018 · 0 comments
Open

Pocketshinx - add new words on language model on the fly #39

1Caxz opened this issue Jan 16, 2018 · 0 comments

Comments

@1Caxz
Copy link

1Caxz commented Jan 16, 2018

Hi guys, I need help.
I try to add new words in current language model already set. But the new words cannot be recognized. What's wrong with this code?

String[] words = {"one", "two", "three"};
// Language model already seted. So, this lmModel is not null.
NGramModel lmModel = speechRecognizer.getDecoder().getLm("CURRENT_LM");
for (String word: words) {
     int result = lmModel.addWord(word.trim().toLowerCase(Locale.ENGLISH), 1.7f);
     System.out.println("Result word: " + a);
     if (result < 0) {
          System.out.println(word + " doesn't support. Please add word \""+ word + "\" in dictionary.");
     }
}
// I have tried to remove and add this line but the result is same.
speechRecognizer.getRapidDecoder().setLm(SEARCH_ID, lmModel);

The result values are:

Result word: 7
Result word: 8
Result word: 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant