artyom.initialize

  • Last modification :
  • 993 views
Parameters type
configuration object
Returns type
If the configuration is valid initialize function will return true, otherwise or in error case false boolean

This function allows the user start artyom with custom properties. The first parameters must be an object.

These are the properties that can be charged with this function :

Name Allowed type Default value what does
listen Boolean false if listen is equal to true the voice recognition will be started otherwise this property can be ignored.
speed Float 1 moderates the speed with which Artyom talks (0 ~ 1)
continuous Boolean false Choose if you want Google Now mode (false) that only listen 1 command and then stops, or a Jarvis (true), that will listen forever (Recognizing all the commands that you give)
debug Boolean false This property allows the developer to be aware of what happens with the recognition of Artyom. Displays all the grammars recognized in the console
volume Float 1 Adjust the volume of the voice of artyom
lang String "en-GB" Set the default language of artyom with this property
mode String "normal"

Available modes :

  • normal
  • quick
  • remote

Normal : the commands will be processed if the last recognized text is the final part.

Quick mode : If mode is set to "quick" , artyom will process every word that you say, this provides a quickest recognition, however this mode is not recommended when you use smart commands o long normal commands, but ... why? for example if we have the following commands in the following order: 

"don't add reminder" <- This do something called A
"add reminder"<- This do something called B 

If you say to artyom "add reminder" in quick mode; Artyom will execute the first instruction because he find add reminder in that command although there's other exactly command with "add reminder". This mode can be used if you use very simple and different commands.
Anyway this is just a testing property, pay attention how it works. Quick mode is not recomendable in PRODUCTION Environment of your project

Remote mode : use the remote mode to process your commands in a remote server (or any kind of self-implemented web service). This mode ignores the locally added commands and it will execute the function saved in artyom.remoteProcessorService(function).

executionKeyword String null Set a keyword that allows your command to be executed immediately when you say this word (Useful in noisy environments)
obeyKeyword String null Set a keyword that allows to enable the command recognition automatically if this word (or words) is recognized while artyom is paused by artyom.dontObey.
soundex Boolean false

Enable the soundex algorithm for the command recognition. Sometimes the speech recognition is not 100% accurate, therefore you may want to enable to match a command even when the speech recognition API recognizes something wrong.

For example, if you have a command that reacts to "Open Wallmart" and artyom recognizes "Open Willmar" the command will be not triggered. However, if the soundex option is enabled and artyom recognizes "Open Willmar" the command that reacts to "Open Wallmart" will be executed because the soundex index of these words is the same (O154).

Official supported languages by Artyom

Read information about the supported languages here

Examples of initialization (One Command Mode)

Artyom in Spanish Mode

artyom.initialize({
    lang:"es-CO",
    debug:true, //Show what recognizes in the Console
    listen:true //Start listening after this 
});

Artyom in English Mode

artyom.initialize({
    lang:"en-GB",
    debug:true, //Show what recognizes in the Console
    listen:true, //Start listening after this
    speed:0.8, // Talk a little bit slow
});

Examples of initialization (Continuous "JARVIS" Mode)

Artyom in Spanish Mode

artyom.initialize({
    lang:"es-CO",
    continuous:true,//Listen Forever
    debug:true, //Show what recognizes in the Console
    listen:true //Start listening after this 
});

Artyom in English Mode

artyom.initialize({
    lang:"en-GB",
    continuous:true,//Listen Forever
    debug:true, //Show what recognizes in the Console
    listen:true, //Start listening after this 
    volume:0.5//Talk a little softer
});

Checking if artyom was correctly initialized

The artyom.initialize function returns a Promise:

artyom.initialize({
    lang:"en-GB",
    continuous:true,
    debug:true,
    listen:true
}).then(() => {
    artyom.say("Artyom succesfully initialized");
}).catch((err) => {
    artyom.say("Artyom couldn't be initialized, please check the console for errors");
    console.log(err);
});

Using the executionKeyword

artyom.addCommands({
    indexes:["Stop the music","Shut up the music"],
    action:function(i){
        var musicEnvironment = new ImaginaryMusicEnvironment();
        musicEnvironment.stop();
    }
});

artyom.initialize({
    executionKeyword:"and do it now",
    lang:"en-GB",
    debug:true, //Show what recognizes in the Console
    listen:true //Start listening after this 
});

// Now imagine that you are in a noisy city and you say "Stop the music".
// Without a execution keyword artyom will take time to accomplish that task because there
// are more persons talking and it hear everything. But with an execution keyword :
// Say "Stop the music and do it now" <- Will stop the music inmmediately
Become a more social person

Buy cheap PC games

Advertising