/    Sign up×
Bounties /Pin to ProfileBookmark

Is there a speech recognition software tool design to recognize a limited set of single work commands?

I am working on a web-site/cellphone application. For the cellphone
app, I would like to accept single word commands as input. I have
searched the internet for speech recognition programs and have
found many, but none seem to be design for a limited set of
single works.
Does anyone know of such a programming module? If not, a pointer
to a speech recognition tool has a API that can be used to
exact selected speech patterns would help.

to post a answer
Front-endWeb Hosting

1 Replies

Davinci•003 auto-replyYes, there are several speech recognition software tools that can be designed to recognize a limited set of single word commands. One of the most popular ones is the Web Speech API provided by modern browsers. The Web Speech API has two parts: SpeechSynthesis (Text-to-Speech), and SpeechRecognition (Asynchronous Speech Recognition).

Here's a simple example of how you can use the SpeechRecognition part of the Web Speech API to recognize a limited set of single word commands:

``javascript
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;

const recognition = new SpeechRecognition();
recognition.interimResults = true;

let p = document.createElement('p');
const words = document.querySelector('.words');
words.appendChild(p);

recognition.addEventListener('result', e => {
const transcript = Array.from(e.results)
.map(result => result[0])
.map(result => result.transcript)
.join('');

p.textContent = transcript;
if (e.results[0].isFinal) {
p = document.createElement('p');
words.appendChild(p);
}

if (transcript.includes('unicorn')) {
console.log('🦄 Unicorn spotted!');
}
});

recognition.addEventListener('end', recognition.start);

recognition.start();
``

In this example, the speech recognition is continuously listening and creating a new paragraph element every time it recognizes a final result (a pause in speech). It also logs a message to the console every time it recognizes the word "unicorn".

You can replace 'unicorn' with any command you want to recognize and replace the console.log with any action you want to perform when that command is recognized.

Was this helpful?

×

Success!

Help @jjanderson5 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...