Runtime¶
These settings inspect the state, or change the behavior, of Session object instances. They are not serialized by save or dup.
Most applications will use ->audio-pcm with push or run to present audio samples to a recognition task.
Access runtime settings with the Session get or set function that matches the setting type. For example, use setStream to change the input stream for ->audio-pcm.
->audio-pcm¶
runtime input stream write-only
->feature¶
runtime input stream write-only pre-release
Input feature stream.
Pre-release
This is an experimental feature. Do not use unless recommended by Sensory.
Source stream in a proprietary Sensory format.
<-audio-pcm¶
<-feature¶
runtime output stream write-only pre-release
Output feature stream.
Pre-release
This is an experimental feature. Do not use unless recommended by Sensory.
Headerless feature output in a proprietary Sensory format.
add-context¶
runtime int read-write
Current enrollment includes trailing context.
Set to 1 if the enrollment recording should include trailing context, for example: "Hey Sensory will it rain tomorrow?"
audio-stream-from¶
runtime double read-write
Audio stream requested start index.
Start the next audio-stream at this sample index value. Defaults to audio-stream-first.
audio-stream-to¶
runtime double read-write
Audio stream requested end index.
End the next audio-stream at this sample index value. Defaults to audio-stream-last.
auto-flush¶
runtime int read-write 6.20.0
Recognition pipeline end-of-stream flush behavior.
This boolean value controls whether run flushes the recognition pipeline when one (or more) of the input streams report an end-of-file condition.
The default value is 1, which enables automatic flushing on EOF. This is appropriate for most applications. Set auto-flush to 0 when audio is presented to run in small segments.
delete-user¶
runtime string write-only
dsp-acmodel-stream¶
runtime output stream read-only
Embedded device acoustic model data.
dsp-target, dsp-header-stream, dsp-search-stream, dsp.production-ready, dsp.t-slice-version
dsp-header-stream¶
runtime output stream read-only
Embedded device search header.
dsp-target,dsp-acmodel-stream, dsp-search-stream, dsp.t-slice-version
dsp-search-stream¶
runtime output stream read-only
Embedded device search model data.
dsp-target, dsp-acmodel-stream, dsp-header-stream, dsp.t-slice-version
dsp-target¶
runtime string read-write
Embedded (DSP) device target name.
dsp-acmodel-stream, dsp-header-stream, dsp-search-stream, dsp.t-slice-version
grammar-stream.¶
runtime input stream write-only tnl
Recognition grammar stream.
Creates a recognizer from a grammar specification read from a stream. The grammar must use UTF‑8 encoding. The new model will recognize only those phrases that the grammar generates.
The model will be ready to recognize once setStream returns. For larger grammars the build process can take a significant amount of time.
See grammar syntax for detail on how grammars are structured.
To create a grammar for a class, append the class name to grammar-stream.:
Example
Note
Requires a TrulyNatural model that supports building.
model-license-exp-date¶
runtime double read-only
Model license expiration date.
Returns the license expiration date of the most recently loaded model in seconds since the epoch, or 0 if no model is loaded.
For production keys, which never expire, the expiration date is 0.
Example
model-license-exp-message¶
runtime string read-only
Model license expiration message.
Returns an expiration message string for the most recently loaded model, or NULL if no model is loaded.
The returned string is of the form "Model license expires on <date>", or NULL for model license keys that do not expire.
Example
model-license-exp-warn¶
runtime string read-only
Model license expiration warning message.
This value is NULL for models with license keys that either do not expire, or that have an expiration date that is more than 60 days into the future.
For license keys expiring in 60 days or fewer, the returned string will be of the form "License will expire in 37 days.".
model-name¶
runtime string read-write
Source model name.
The name of the model file used to create:
- ROM-able C code with save and SOURCE.
- A model in one of the supported embedded formats with dsp-header-stream.
This value is included in the comment header of the generated code, for information only.
model:ids¶
runtime string read-write
Prepares a Session for generating custom initialization code.
Set this value to NULL to enable load instrumentation. This is used by save with SUBSET_INIT to generate custom library initialization code (in C), which references only modules encountered during load.
Linking against only a subset of available modules reduces executable size.
This example will create a custom-init.c file. Add this to the build, and recompile with -DSNSR_USE_SUBSET to enable. The linked executable(s) will contain just the modules required to run model-a.snsr and model-b.snsr.
nlu-grammar-stream.¶
runtime input stream write-only tnl stt
NLU grammar stream.
Creates a lightweight NLU parser from a grammar specification read from a stream. It takes precedence over NLU specified with grammar-stream and can be used as an alternative to machine-learned NLU in some STT models.
The grammar must use UTF‑8 encoding. The NLU model will recognize only those phrases that the grammar generates.
The NLU parser is applied to the recognition result, ^result, and generates ^nlu-intent and ^nlu-slot events for each match found.
The model will be ready to recognize once setStream returns. For larger grammars the build process can take a significant amount of time.
See grammar syntax for detail on how grammars are structured.
To create a grammar for a class, append the class name to nlu-grammar-stream.:
Example
Note
Requires a TrulyNatural model that supports building.
phrases-stream.¶
runtime input stream write-only tnl
Recognition phrase list stream.
Creates a recognizer from a list of phrases read from a stream. The phrase list must use UTF‑8 encoding. Individual phrases are separated by newlines or semicolons. Comments start with # and run until the end of the phrase. Only the exact phrases in the list will be part of the recognition language.
This utility setting converts the list of phrases into this grammar specification:
To create a phrase list for a class, append the class name to phrases-stream.:
Example
Note
Requires a TrulyNatural model that supports building.
prune:enable¶
runtime string read-write 7.5.0
Prepare a Session for pruning model settings
Pruning unused settings from a model reduces peak RAM requirements. This is typically only useful on platforms where heap memory is constrained.
Set prune:enable to yes to instrument model loading and running. This instrumentation:
- Keeps track of which configuration settings the application accesses during model evaluation,
- adds a list of these settings to the model upon saving, and
- configures the model to prune settings not on this list from the runtime directly after loading.
Set prune:enable to no to disable pruning. This is the default.
Note
Pruned models do not contain enough information to be re-saved.
re-adapt¶
runtime int write-only
Force re-adaptation of all enrollments.
If all users in an enrollment task have been adapted, the adaptation step is skipped. This is the case when one or more adapted enrollment contexts are loaded, and no new users are added.
Setting re-adapt to 1 changes this behavior to always do the adaptation step.
rename-user¶
runtime string write-only
Rename an enrolled user.
Changes the recognition result returned for user to the string argument.
This setting is only available in fixed-phrase spotters that support continuous adaptation.
Example
skip-to-ms¶
runtime int write-only
VAD initial ignore duration, in ms.
Ignore the first skip-to-ms ms of the ->audio-pcm input stream. Use this runtime setting to skip over a trigger phrase included in the source audio. The default is to process all audio.
skip-to-sample¶
runtime int write-only
VAD initial ignore duration, in samples.
Ignore the first skip-to-sample samples of the ->audio-pcm input stream. Use this runtime setting to skip over a trigger phrase included in the source audio. The default is to process all audio.
tag-identifier¶
runtime string read-write
Exported identifier in ROM C code.
When text segment C code is created with save and SOURCE, this setting specifies the name of the exported data structure.
The value must start with an ASCII alphabetic character or _, and contain only alphanumerics and _; it must match regular expression [A-Za-z_][A-Za-z0-9_]*