Comments (4)
You can not do that. Confidence is available in C api with ps_get_prob
call which is not used in bindings.
from pocketsphinx-ruby.
I've made it possible to get at this value using Pocketsphinx::Decoder::Hypothesis#posterior_prob
. Does this help? Is there some additional normalization calculation that would be worth adding to the hypothesis?
@nshmyrev Does calling ps_get_prob
every time I call ps_get_hyp
have any negative performance implications?
from pocketsphinx-ruby.
@watsonbox IMO a step in the right direction, but the posterior probability is logarithmic and needs to be converted to a decimal probability in order to get to a more meaningful confidence score, e.g. .81
= 81% confidence, etc. According to my investigation, I think an approach worth investigating is the following:
...
# Add inside Pocketsphinx::API::Pocketsphinx
typedef :pointer, :logmath
attach_function :ps_get_logmath, [:decoder], :logmath
attach_function :logmath_get_base, [:logmath], FFI::NativeType::FLOAT64
attach_function :logmath_exp, [:logmath, :int], FFI::NativeType::FLOAT64
...
# Pocketsphinx::Decoder
logmath = ps_api.ps_get_logmath(ps_decoder)
logbase = ps_api.logmath_get_base(logmath)
log_prob = ps_api.ps_get_prob(ps_decoder) # -> -9834
dec_prob = ps_api.logmath_exp(logmath, log_prob) # => 0.83111
Something similar needs to happen per word within an utterance:
# Inside Pocketsphinx::Decoder
def words
...
acoustic_score = FFI::MemoryPointer.new(:int32, 1)
language_score = FFI::MemoryPointer.new(:int32, 1)
language_backoff = FFI::MemoryPointer.new(:int32, 1)
ps_api.ps_seg_prob(seg_iter, acoustic_score, language_score, language_backoff)
...
Again, these scores are logarithmic and need to be converted before they are meaningful.
from pocketsphinx-ruby.
Sorry for the delay! Please let me know if my commit resolves these issues.
from pocketsphinx-ruby.
Related Issues (20)
- run Travis build inside docker container for improved performance HOT 3
- Segfault when reconfiguring HOT 3
- FFI::NullPointerError: invalid memory read at address=0x00000000000000 HOT 2
- Add words to hyphotesis
- Hypothesis changes for the same audio file. HOT 18
- Don't lazy initialize PS decoder HOT 9
- Recent buffer size changes seem to slow down recognition
- Test failure: Decoder#unset_search failed with error code -1 HOT 1
- SpeechRecognizer#recognize_after_speech yields hypothesis instead of decoder HOT 2
- Decoder#unset_search failed with error code -1 HOT 1
- Setting log level? HOT 2
- Using live recorder to generate audio files on silence? HOT 1
- Recognizer crashes both when importing grammar from JSGF and dynamically generating grammar HOT 1
- Wrong frames number HOT 3
- How do I detect multiple keywords? HOT 2
- Could not open library 'libsphinxbase.so' HOT 2
- Audio file does not translate. HOT 1
- Can't even test Pocketsphinx
- Microphone starts recording immediately
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pocketsphinx-ruby.