Skip to main content

AsrModule.AsrTranscriptionOptions

Class

Provides 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

Platform details

  • Snapchat — Not supported — Available on SPECS only.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported — Available on SPECS only.

  • Camera Kit Mobile — Not supported — Available on SPECS only.

Provides the options for the session.

Index

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

readonly onTranscriptionErrorEvent: event1<AsrStatusCode, void>

SPECS

An event triggered by transcription errors.


onTranscriptionUpdateEvent

readonly onTranscriptionUpdateEvent: 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()

static create(): AsrTranscriptionOptions

SPECS

Creates a new instance.

Returns

AsrTranscriptionOptions


getTypeName()

static getTypeName(): 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

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


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

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame