Skip to content

Commit

Permalink
Enforce SpeechRecognition.maxAlternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
abrichr committed Oct 6, 2015
1 parent b6f62d1 commit 74c6ae1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion annyang.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@
// Map the results to an array
var SpeechRecognitionResult = event.results[event.resultIndex];
var results = [];
for (var k = 0; k<SpeechRecognitionResult.length; k++) {
var K = Math.min(SpeechRecognitionResult.length, recognition.maxAlternatives);
for (var k = 0; k < K; k++) {
results[k] = SpeechRecognitionResult[k].transcript;
}

Expand Down

0 comments on commit 74c6ae1

Please sign in to comment.