-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
When using setMaxAlternatives the confidence level from words are gone and the confidence level on the whole text is very strange number.
I was expecting a value between 0.0 and 1.0, but instead I get numbers in the hundreds without any clue on what they represent
"alternatives" : [{
"confidence" : 297.045959, // of what ? _ ?
"result" : [{
"end" : 2.130000,
"start" : 1.740000,
"word" : "i'm",
// "conf": "IS GONE"
}, {
"end" : 2.160000,
"start" : 2.130000,
"word" : "a"
// "conf": "IS GONE"
}, {
"end" : 2.640000,
"start" : 2.160000,
"word" : "guy"
// "conf": "IS GONE"
}],
"text" : "i'm a guy"
}]Can be reproduced with modified example
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/msqr1/[email protected]/Examples/Vosklet.js" async defer></script>
<script>
async function start() {
// All data is collected and transfered to the main thread so the AudioContext won't output anything. Set sinkId type to none to save power
let ctx = new AudioContext({sinkId: {type: "none"}});
// Setup microphone
let micNode = ctx.createMediaStreamSource(await navigator.mediaDevices.getUserMedia({
video: false,
audio: {
echoCancellation: true,
noiseSuppression: true,
channelCount: 1
},
}));
let module = await loadVosklet();
let model = await module.createModel("https://ccoreilly.github.io/vosk-browser/models/vosk-model-small-en-us-0.15.tar.gz","English","vosk-model-small-en-us-0.15");
let recognizer = await module.createRecognizer(model, ctx.sampleRate);
recognizer.setWords(true);
recognizer.setMaxAlternatives(2);
// Listen for result and partial result
recognizer.addEventListener("result", ev => console.log("Result: ", ev.detail));
recognizer.addEventListener("partialResult", ev => console.log("Partial result: ", ev.detail));
// Create a transferer node to get audio data on the main thread
let transferer = await module.createTransferer(ctx, 128 * 150);
// Recognize data on arrival
transferer.port.onmessage = ev => {
recognizer.acceptWaveform(ev.data)
};
// Connect transferer to microphone
micNode.connect(transferer);
}
</script>
<!-- Start and create audio context only as a result of user's action -->
<button onclick="start()">Start</button>
</head>
</html>Metadata
Metadata
Assignees
Labels
No labels