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.APISubmodule
JustSayIt.API — ModuleModule API
Application Programming Interface (API) of JustSayIt.
Macros
Functions
Constants
To see a description of a function, macro or module type ?<functionname>, ?<macroname> (including the @) or ?<modulename>, respectively.
Macros
Index
Documentation
JustSayIt.@voiceargs — Macro@voiceargs args functionDeclare some or all arguments of the function definition to be arguments that can be obtained by voice.
Arguments
args: a voicearg, a pairvoicearg=>kwargsor a tuple with multiple voiceargs, which can each have kwargs or not (see examples below).function: the function definition.
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 toinit_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 setuse_max_speed=truefor 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 setignore_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
endFunctions
Index
JustSayIt.API.is_nextJustSayIt.API.are_nextJustSayIt.API.pause_recordingJustSayIt.API.restart_recording
Documentation
JustSayIt.is_next — Functionis_next(token)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.
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 toinit_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 setuse_max_speed=truefor single word commands or very specfic use cases that require immediate minimal latency action when a command is said.
See also: are_next
JustSayIt.are_next — Functionare_next(token)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.
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 toinit_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 setuse_max_speed=truefor single word commands or very specfic use cases that require immediate minimal latency action when a command is said.
See also: is_next
JustSayIt.pause_recording — FunctionJustSayIt.restart_recording — FunctionConstants
Index
Documentation
JustSayIt.LANG — ConstantConstant named tuple containing names of available languages.
JustSayIt.MODELNAME — ConstantConstant named tuple containing modelnames for available languages.