Skip to main content

Optional Settings

In combination of the settings required to initiate the library into your desired mode, there are a few different optional settings you can configure during the initiation.

ParametersTypeDescription
usePhoneticMatchingbooleanMatches transcribed words and game commands based on how the words sound rather than how they are spelled.

Phonetic Matching will convert each spoken word into a phonetic code using the Double Metaphone algorithm. Depending on how close the two codes are, will determine the confidence level in which they are phonetically the same.

Example: The word 'read' as in "I read a book", sounds exactly the same as the word 'red', as in "My favorite color is red." The phonetic matching algorithm will have these two words match at a 100% confidence level.
confidenceThresholdnumberTakes a number between 0-1 inclusive. 1 being an exact match. The confidence level required to trigger a game command if a word is spoken.
logConfidenceScoresbooleanA developer tool that will display confidence levels of words in the console log. Should be turned off in a production environment
note

Phonetic Matching is turned on by default with a confidence threshold of 0.8 (80%).

Example in Offline Mode:

const voice = new AACVoiceAPI();

await voice.initiate({
mode: 'offline',
modelUrl: modelUrl,
language: 'en',
usePhoneticMatching: true,
confidenceThreshold: 0.9,
logConfidenceScores: false,
});

Example in Online Mode:

const voice = new AACVoiceAPI();

await voiceApi.current.initiate({
mode: 'online',
modelUrl: 'http://localhost:8000',
usePhoneticMatching: true,
confidenceThreshold: 0.9,
logConfidenceScores: false,

})