-
-
Notifications
You must be signed in to change notification settings - Fork 1
API
Set any config options. The list of config options and their defaults is available at https://github.com/osprey-voice/osprey/blob/master/osprey/config.py. Only the options that you want to change need to be provided, the rest will be provided from the default.
Quits Osprey.
Opens a given file with the default program.
A collection of commands that can be enabled and disabled based on some conditions.
Initialize a Context
object with a given name.
If another Context
is later initialized with the same name, it will overwrite the previous one.
Set the rule/action pairs for the Context. A rule is a pattern of words with some additional syntax.
The additional syntax includes:
-
[words]
: these words become optional -
(words1|words2)
: either words1 or words2 can match, but not both
If a rule is matched, its corresponding action will be called with a match parameter.
The match parameter is a dict
of elements corresponding to the matched value of a placeholder.
A placeholder is an element with angle brackets and can be one of the following:
-
<word>
: astr
of one spoken word -
<phrase>
: astr
of spoken words -
<n>
: anint
from 0 to 100 -
<{choice}>
: astr
of one of the items of a choice
A placeholder can optionally be followed by one of:
-
*
: alist
of 0 or more of the placeholder -
+
: alist
of 1 or more of the placeholder
If a placeholder is made optional and is not matched in a given transcript, its value in the match parameter is set to None
.
Set the choices for the Context
.
Choices can be accessed from any rule of the Context
with the <{choice}>
syntax.
Inserts a given string by pressing one key at a time.
Presses a key or key combination.
The list of keys supported is available at: https://github.com/osprey-voice/osprey/blob/master/osprey/keys.py.
Uppercase letters are also supported.
Key modifiers are separated by a space.
On macOS, Ctrl
is converted to the Command
key.
Repeats the previous insert
or press
a given number of times.
Undoes the previous insert
by pressing Backspace
the same number of times as the length of the previously inserted string.