Problem: using the "Cordova Plugin for Speech Recognition" in an Android app, the startListening()
function almost always returns 5 matches, despite setting matches: 1
.
matches
is defined as: {Number} number of return matches (default5
)
For example:
- speaking: "What's up"
- returns: "what's up,whatsup,watsup,wat's up,what sup"
Question: how can I restrict the output to return just a single value/best match?
Sample code to illustrate how I have set the matches
option:
function startRecognition(inputFieldId){
window.plugins.speechRecognition.startListening(function(result){
// Show the result in the corresponding input field
document.getElementById(inputFieldId).setAttribute("value", result);
}, function(err) {
console.error(err);
}, {
language: "en-US", matches: 1, prompt: "", showPopup: false
});
};
Note: modifying the other options, like prompt
works fine, but modifying matches
does nothing.