syl22-00 / pocketsphinx.js

Speech recognition in JavaScript and WebAssembly
1.49k stars 261 forks source link

Getting recognition scores for hypothesis #29

Closed pramodsum closed 9 years ago

pramodsum commented 9 years ago

Hi!

I'm working on a a pronunciation training app and wanted to use pocketsphinx.js to calculate pronunciation scores. Using the example webapp I was able to integrate my custom Hindi Acoustic and language models with the recognition.

I wanted to know if there is any way for me to not only get the hypothesis of which word was spoken but the probability that the word recognized was the intended word? I was looking into forking this repo and adding that code in myself but didn't really know where to look to change that.

Thanks!

syl22-00 commented 9 years ago

This question has been asked several time in github tickets (such as #3).

This is best answered by developers of pocketsphinx, you can reach them on http://cmusphinx.org or on #cmusphinx on IRC.

pramodsum commented 9 years ago

I'm having trouble with compiling pocketsphinx.js with my modified psRecognizer.cpp and psRecognizer.h.

I added some methods to the recognizer class, however, when i'm compiling pocketsphinx.js using make, my added methods aren't available anymore. I think i'm messing up something fairly basic. I'm using just the cmake command without specifying any acoustic model or language model.

$ cmake -DEMSCRIPTEN=1 -DCMAKE_TOOLCHAIN_FILE=path_to_emscripten/cmake/Modules/Platform/Emscripten.cmake
$ make

Even if I wanted to add a very simple method such as shown below to access a private variable I added in psRecognizer.h. I'm not able to use that method in recognizer.js after compiling the pocketsphinx.js

int32 Recognizer::getHypAccuracy() {
    return accuracy;
 }

Any help would be appreciated! Thanks!

syl22-00 commented 9 years ago

You need to register your new method to embind, see the lower part of psRecognizer.h.

pramodsum commented 9 years ago

thanks!