3 days, 4 days, 5 days – you can do it through a template like “$ Number (days | days | day)”

This is described in the example. In the template, you need to write the phrase that you will pronounce.
Dusya will compare your phrase with a template. For example, “good morning *” would match the phrases “good morning” or “good morning”
Since version 1.2.0 Dusya can understand not only static phrases for activating a script, but also flexible phrase templates. And also operate with parameters in phrases
and pass them to script commands.

To do this, you need to use a special template syntax.
Example. The pattern “* {(what | cho) * [will] $ Date}” will work for any of the phrases “What will happen tomorrow”, “Tell me what tomorrow”, “Cho in a week”, etc. From this
example, you probably already understand the simple rules of templates, which will be described below.

Also, the commands of this script may contain the following: “Weather $ Date” and “Plans for $ Date”. This means that Dusya will substitute data instead of $ Date from the input
phrases in all commands where the $ Date parameter is specified.

Constructs used in templates

Star
* means any number of words, if it is indicated separately from the word. For example, the pattern “Hello * friend” will work on the phrases “Hello my friend” or “Hello friend”

If an asterisk is written in a word (at the beginning and / or at the end), then this means that the word can begin or end with any letters. For example, the template
“Hello *” will work on both “Hello” and “Hello”

Permutations

We often change the order of words in colloquial speech. Therefore, you can use parentheses {and} to indicate words that can be swapped. For example, in the template
“{hi how are you}” you can swap all the words and it will still work.

Alternatives

You can use parentheses (and) to indicate alternative words that may appear at a specific point in the phrase. For example, the pattern “hello
(friend | buddy) “will trigger the phrases” hello friend “and” hello buddy “.

Optionality

If some construction in the phrase may be missing, then you can enclose it in square brackets [and]. For example, the pattern “hello [my | my] (friend | girlfriend)”
will also work in cases where you do not say the word “mine” or “mine” in the middle of the phrase.

Parameters

You can specify some parameters in the phrase, which will then be passed to the executed commands. To do this, you need to use the $ sign in front of the name
parameter. For example, the template “what we have is $ Date” will work for all phrases like “what we have today” or “what we have in a week”, and for all commands in
scripts that contain the $ Date parameter, the phrase from the input phrase will be substituted instead of $ Date. For example, one of the commands could be written
like “$ Date weather”. Then with the phrase “What do we have tomorrow” the command “weather tomorrow” will be executed.

List of possible parameters (case of letters is important !!!)

Text – any text (including empty)
Number – any number (including in verbal form)
Date – date (absolute and relative)
Time – time (absolute and relative)
App – the name of the installed application
Site – site address (for example, mail.ru or yandex.ru)
Contact – full name of the contact from the contact list
StreetAddress – street name (with the keywords “street”, “avenue”, etc.)
CityAddress – the name of the city (with the keywords “city”, “village”, etc.)
KnownAddress – one of the saved addresses (from the “Navigation” function)
PlaceType – the category of the place (from the “Places” function)
TranslatorLang – translation language (from the “Translator” function)
NewsTopic – news topic (from the “News” function)
RssChannel – the name of the RSS feed (from the “RSS feed” function)
ScriptName – another script template

Several of the same parameters

To specify several of the same parameters in one template, use the naming sign ::
For example, in the “Add $ X :: Number and $ Y :: Number” pattern, we will split the first and second arguments of the same type “Number”.

Leave a Reply

Your email address will not be published.