Class YSKOnlineRecognizerSettings

Specifies the settings of an object of the YSKOnlineRecognizer class.

The required settings are the recognition language and the model. Other settings can be specified depending on the task.

Instance Methods

-initWithLanguage:model:

Initializes an object of the YSKOnlineRecognizerSettings class.

Properties

asrUrl

URL of the ASR server.

disableAntimat

Flag for allowing obscene words.

enableManualPunctuation

Flag for replacing punctuation words with punctuation marks.

enableMusicRecognition

The ASR server will or will not send music recognition results.

enablePunctuation

Punctuation flag.

enableVAD

Controls the behavior of the Voice Activity Detector (VAD).

encodingBitrate

Bitrate of the selected audio codec (bps).

encodingComplexity

Complexity of the compression algorithm.

energyWeight

The weight of each new chunk of audio data when calculating the speech power.

finishAfterFirstUtterance

Flag for ending recognition after receiving the parameter endOfUtterance = YES (recognizer:didReceivePartialResults:withEndOfUtterance:).

inactiveTimeout

Time to wait for speech, in seconds, after starting an object of the YSKOnlineRecognizer class.

language

Voice query language.

model

Model used for speech recognition.

reachabilityTimeout

Network connection timeout.

recordingTimeout

Maximum length of a voice query record in seconds.

requestBiometry

Flag indicating a request for the user's estimated biometrics (such as age, gender, or age group).

silenceBetweenUtterances

Minimum period of silence between utterances, in seconds.

soundCacheLength

The maximum audio length, in milliseconds, to be resent to the server if the network connection is lost.

soundFormat

Audio format.

waitForConnection

Flag indicating that audio recording starts after a network connection is established.

waitForResultTimeout

Time to wait for server response after sending the last fragment.

Method Detail

-initWithLanguage:model:

- (instancetype)initWithLanguage:(YSKLanguage *)language
                           model:(YSKOnlineModel *)model 

Initializes an object of the YSKOnlineRecognizerSettings class.

This method is a designated initializer for the YSKOnlineRecognizerSettings class.
Parameters:
language

Recognition language.

model

Recognition model.

Returns:

An object of the YSKOnlineRecognizerSettings class.

Property Detail

asrUrl

(copy, readwrite) NSString * asrUrl

URL of the ASR server.

disableAntimat

(assign, readwrite) BOOL disableAntimat

Flag for allowing obscene words.

Acceptable values: YES — the ASR server will keep obscene words; NO— the ASR server will skip obscene words. Default value: NO.

enableManualPunctuation

(assign, readwrite) BOOL enableManualPunctuation

Flag for replacing punctuation words with punctuation marks.

Acceptable values: YES — the ASR server will replace punctuation words with marks; NO — the ASR server will not replace punctuation words with marks. Default value: NO. For example, the utterance "Hello comma how are you question mark" can be recognized as "Hello, how are you?".

enableMusicRecognition

(assign, readwrite) BOOL enableMusicRecognition

The ASR server will or will not send music recognition results.

Acceptable values: YES — the ASR server will or will not send music recognition results; NO — the ASR server will not send music recognition results. Default value: NO.

enablePunctuation

(assign, readwrite) BOOL enablePunctuation

Punctuation flag.

Acceptable values: YES — the ASR server will insert punctuation marks in the text; NO — the ASR server will not insert punctuation marks in the text. Default value: YES.

enableVAD

(assign, readwrite) BOOL enableVAD

Controls the behavior of the Voice Activity Detector (VAD).

If the VAD is disabled, the YSKOnlineRecognizer class object does not detect the end of speech automatically. In this case, call the stopRecording method to stop recording and switch to recognition. Default value: YES.

encodingBitrate

(assign, readwrite) NSInteger encodingBitrate

Bitrate of the selected audio codec (bps).

The bitrate determines the approximate number of bits one second of compressed audio will take. This parameter affects the quality of sound, so it also affects the quality of recognition. The recommended range for opus is from 12000 to 64000 bps if the encodingComplexity property value is set to 10. When the PCM format is selected, this parameter is not used. The default value at which the optimal size/quality ratio is achieved is 24000.

encodingComplexity

(assign, readwrite) NSInteger encodingComplexity

Complexity of the compression algorithm.

The complexity of the algorithm affects the quality of audio, so it also affects the quality of recognition. An increase in the complexity at the fixed bitrate allows achieving better audio quality, but also increases the processor load and encoding time. However, the dependency is nonlinear, and with a bitrate of 24000 bps a high recognition quality is achieved with any complexity value, while with a bitrate of 12000 bps a good quality can only be achieved if the complexity value is set to 10. When the PCM format is selected, this parameter is not used. Default value: 0.

energyWeight

(assign, readwrite) CGFloat energyWeight

The weight of each new chunk of audio data when calculating the speech power.

The speech power value can be obtained in the recognizer:didUpdatePower: method.

finishAfterFirstUtterance

(assign, readwrite) BOOL finishAfterFirstUtterance

Flag for ending recognition after receiving the parameter endOfUtterance = YES (recognizer:didReceivePartialResults:withEndOfUtterance:).

Acceptable values:
  • YES — an object of the YSKOnlineRecognizer class will complete recognition when it receives the parameter endOfUtterance = YES.

  • NO — an object of the YSKOnlineRecognizer class will continue recognition even after getting endOfUtterance = YES. You should also configure the 'recordingTimeout' accordingly (for example, set it to -1 or a very large value). Default value: YES.

inactiveTimeout

(assign, readwrite) NSTimeInterval inactiveTimeout

Time to wait for speech, in seconds, after starting an object of the YSKOnlineRecognizer class.

If the YSKOnlineRecognizer class object does not detect any speech during this timeout, it returns the YSKErrorNoSpeechDetected error in the recognizer:didFailWithError: method. Error codes are listed in YSKErrorCode. Default value: 5 seconds.

language

(copy, readonly) YSKLanguage * language

Voice query language.

model

(copy, readonly) YSKOnlineModel * model

Model used for speech recognition.

reachabilityTimeout

(assign, readwrite) NSTimeInterval reachabilityTimeout

Network connection timeout.

A negative value disables the timeout. Default value: 5 seconds.

recordingTimeout

(assign, readwrite) NSTimeInterval recordingTimeout

Maximum length of a voice query record in seconds.

Default value: 20.

requestBiometry

(assign, readwrite) BOOL requestBiometry

Flag indicating a request for the user's estimated biometrics (such as age, gender, or age group).

Acceptable values: YES — request estimated biometric characteristics; NO — do not request estimated characteristics. Default value: NO.

silenceBetweenUtterances

(assign, readwrite) NSTimeInterval silenceBetweenUtterances

Minimum period of silence between utterances, in seconds.

If the pause between words exceeds the specified value, the recognition system will interpret it as the end of the utterance. For negative values, the default server value is used. Default value: -1.

soundCacheLength

(assign, readwrite) NSInteger soundCacheLength

The maximum audio length, in milliseconds, to be resent to the server if the network connection is lost.

If the value is negative, the cache length is not limited. Default value: -1.

soundFormat

(copy, readwrite) YSKSoundFormat * soundFormat

Audio format.

Default value: opus. Possible values can be found in the YSKSoundFormat class.

waitForConnection

(assign, readwrite) BOOL waitForConnection

Flag indicating that audio recording starts after a network connection is established.

Acceptable values: YES — an object of the YSKOnlineRecognizer class will start recording immediately after the network connection is established; NO — an object of the YSKOnlineRecognizer class will start recording immediately after launch and will cache data until the network connection is established. Default value: NO.

waitForResultTimeout

(assign, readwrite) NSTimeInterval waitForResultTimeout

Time to wait for server response after sending the last fragment.

If the server doesn't return a response with endOfUtterance = YES (recognizer:didReceivePartialResults:withEndOfUtterance: method) before the timeout, the YSKOnlineRecognizer object returns an error with the code YSKErrorServer in the recognizer:didFailWithError: method. Default value: 10 seconds.