Open inglesuniversal opened 1 year ago
const userInput = "your user input here"; // Get the user's input const commandKeywords = ["keyword1", "keyword2", "keyword3"];
// Check if any of the keywords are present in the user's input
for (const keyword of commandKeywords) {
if (userInput.includes(keyword)) {
// Perform the action associated with the matched keyword
// This can be a function call or any other action
console.log(Matched keyword: ${keyword}
);
break; // Stop checking once a match is found
}
}
Thanks will try it out!
How to force annyang.trigger('command') to work, even if NOT in listening mode or Speech API is not available on browser.
Thanks