High-level API reference

This is the official High-level API reference of JustSayIt. Note that it can also be queried interactively from the Julia REPL using the help mode:

julia> using JustSayIt
julia>?
help?> JustSayIt.API

Submodule

Macros

Index

Documentation

JustSayIt.@voiceargsMacro
@voiceargs args function

Declare some or all arguments of the function definition to be arguments that can be obtained by voice.

Arguments

  • args: a voicearg, a pair voicearg=>kwargs or a tuple with multiple voiceargs, which can each have kwargs or not (see examples below).
  • function: the function definition.
Keyword arguments definable for each voice argument in `args`
  • model::String=MODELNAME.DEFAULT.<default_language>: the name of the model to be used for the function argument (the name must be one of the keys of the modeldirs dictionary passed to init_jsi).
  • valid_input::AbstractArray{String}|NTuple{N,Pair{String,<:AbstractArray{String}}}: the valid speech input (e.g. ["up", "down"] or ("de" => ["rauf", "runter"], "en-us" => ["up", "down"], "fr" => ["haut", "bas"], "es" => ["arriba", "abajo"])).
  • valid_input_auto::Bool: whether the valid speech input can automatically be derived from the type of the function argument.
  • interpret_function::Function: a function to interpret the token (mapping a String to a different String).
  • use_max_speed::Bool=false: whether to use maxium speed for the recognition of the next token (rather than maximum accuracy). It is generally only recommended to set use_max_speed=true for single word commands or very specfic use cases that require immediate minimal latency action when a command is said.
  • ignore_unknown::Bool=false: whether to ignore unknown tokens in the speech (and consume the next instead). It is generally not recommended to set ignore_unkown=true - in particular not in combination with a limited valid input - as then the function will block until it receives a token it recognizes.
  • vararg_end::String: a token to signal the end of a vararg (only valid if the function argument is a vararg).
  • vararg_max::Integer=∞: the maximum number of arguments the vararg can contain (only valid if the function argument is a vararg).
  • vararg_timeout::AbstractFloat: timeout after which to abort waiting for a next token to be spoken (only valid if the function argument is a vararg).

Examples

@voiceargs (b, c) function f(a, b::String, c::String, d)
    #(...)
    return
end

@voiceargs (b=>(use_max_speed=true), c) function f(a, b::String, c::String, d)
    #(...)
    return
end

@enum TypeMode words formula
@voiceargs (mode=>(valid_input_auto=true), token=>(model=MODELNAME.TYPE.EN_US, vararg_timeout=2.0)) function type_tokens(mode::TypeMode, tokens::String...)
    #(...)
    return
end
source

Functions

Index

Documentation

JustSayIt.is_nextFunction
is_next(token)
Advanced

is_next(token; <keyword arguments>)

Check if the next token in the speech matches token; if yes, return true, else, return false. If token is an array of strings, check if any of them matches the next token in the speech. A call to is_next does by default not consume the next token (nor fix the recognizer to be used for its recognition).

Arguments

  • token::String | AbstractArray{String}: the token(s) to compare the next token in the speech against.
Advanced keyword arguments
  • modelname::String=MODELNAME.DEFAULT.<default_language>: the name of the model to be used for the recognition in the token comparison (the name must be one of the keys of the modeldirs dictionary passed to init_jsi).
  • consume_if_match::Bool=false: whether the next token is to be consumed in case of a match.
  • timeout::Float64=Inf: timeout after which to abort waiting for a next token to be spoken.
  • use_max_speed::Bool=false: whether to use maxium speed for the recognition of the next token (rather than maximum accuracy). It is generally only recommended to set use_max_speed=true for single word commands or very specfic use cases that require immediate minimal latency action when a command is said.

See also: are_next

source
JustSayIt.are_nextFunction
are_next(token)
Advanced

are_next(token; <keyword arguments>)

Check if the next group of tokens in the speech match token; if all match, return true, else, return false. If token is an array of strings, check if any of them match the next tokens in the speech. A call to are_next does by default not consume the next tokens (nor fix the recognizer to be used for its recognition).

Arguments

  • token::String | AbstractArray{String}: the token(s) to compare the next token in the speech against.
Advanced keyword arguments
  • modelname::String=MODELNAME.DEFAULT.<default_language>: the name of the model to be used for the recognition in the token comparison (the name must be one of the keys of the modeldirs dictionary passed to init_jsi).
  • consume_if_match::Bool=false: whether the next tokens are to be consumed in case that all match.
  • timeout::Float64=Inf: timeout after which to abort waiting for a next token to be spoken.
  • use_max_speed::Bool=false: whether to use maxium speed for the recognition of the next tokens (rather than maximum accuracy). It is generally only recommended to set use_max_speed=true for single word commands or very specfic use cases that require immediate minimal latency action when a command is said.

See also: is_next

source

Constants

Index

Documentation