react-speech-recognizer-component
Version:
React component for Speech Recognition based on Speech Recognition Web API.
30 lines (23 loc) • 701 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.extractTranscripts = void 0;
var extractTranscripts = function extractTranscripts(results) {
var transcripts = [];
var totalResults = results.length;
var resultsIndex = 0;
while (resultsIndex < totalResults) {
var result = results.item(resultsIndex);
var totalAlternatives = result.length;
var alternativesIndex = 0;
while (alternativesIndex < totalAlternatives) {
var alternative = result.item(0);
transcripts.push(alternative.transcript);
alternativesIndex++;
}
resultsIndex++;
}
return transcripts;
};
exports.extractTranscripts = extractTranscripts;