AsrModule.AsrTranscriptionOptions
ClassProvides the options for the session.
- Snapchat: not supported
- SPECS: fully supported
- Camera Kit Web: not supported
- Camera Kit Mobile: not supported
- SnapchatNot supported — Available on SPECS only
- SPECSFully supported
- Camera Kit WebNot supported — Available on SPECS only
- Camera Kit MobileNot supported — Available on SPECS only
Provides the options for the session.
Index
Properties
Methods
Example
const options = AsrModule.AsrTranscriptionOptions.create()
options.silenceUntilTerminationMs = 1000
options.mode = AsrModule.AsrMode.HighAccuracy
options.onTranscriptionUpdateEvent.add((eventArgs) => print(eventArgs))
options.onTranscriptionErrorEvent.add((eventArgs) => print(`Error while transcribing: ${eventArgs}`))
Extends
Properties
contentType
contentType:
AsrContentType
SPECS
The kind of content the speech is expected to carry, used to pick how the speech is processed and formatted.
Since
Lens Scripting Version 384
Default Value
AsrModule.AsrContentType.Text
@snapOS
Example
const options = AsrModule.AsrTranscriptionOptions.create()
// The transcription fills in an email field.
options.contentType = AsrModule.AsrContentType.Email
language
language:
string
SPECS
The target language of the transcription in ISO 639 format. "auto" detects the spoken language.
When AsrModule.AsrTranscriptionOptions#contentType is AsrModule.AsrContentType.Translation, this is the language the speech is translated into, and "auto" is not a valid value.
Since
Lens Scripting Version 384
Default Value
"auto"
@snapOS
Example
const options = AsrModule.AsrTranscriptionOptions.create()
// Translate whatever is spoken into Spanish.
options.contentType = AsrModule.AsrContentType.Translation
options.language = "es"
mode
mode:
AsrMode
SPECS
The operation mode of the ASR session.
Default Value
AsrModule.AsrMode.HighAccuracy
@snapOS
onTranscriptionErrorEvent
readonlyonTranscriptionErrorEvent:event1<AsrStatusCode,void>
SPECS
An event triggered by transcription errors.
onTranscriptionUpdateEvent
readonlyonTranscriptionUpdateEvent:event1<TranscriptionUpdateEvent,void>
SPECS
An event triggered by transcription updates.
secondaryLanguages
secondaryLanguages:
string[]
SPECS
Additional languages, in ISO 639 format, that speech is expected to switch to alongside AsrTranscriptionOptions#language. Listing them nudges the model towards those languages and can improve accuracy in multi-language settings.
Since
Lens Scripting Version 384
Default Value
[]
@snapOS
Example
const options = AsrModule.AsrTranscriptionOptions.create()
// The speaker mostly talks in English, but is expected to switch to Italian or Spanish.
options.language = "en"
options.secondaryLanguages = ["it", "es"]
silenceUntilTerminationMs
silenceUntilTerminationMs:
number
SPECS
Silence duration in milliseconds to detect the end of the speech.
Default Value
750
@snapOS
Methods
create()
staticcreate():AsrTranscriptionOptions
SPECS
Creates a new instance.
Returns
AsrTranscriptionOptions
getTypeName()
staticgetTypeName():TypeName<AsrTranscriptionOptions>
SPECS
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<AsrTranscriptionOptions>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean