SpeechKit class

ru.yandex.speechkit

public  class  SpeechKit 

Singleton class aimed at setting up and controlling overall SpeechKit operation.

SpeechKit objects do not need to be created or destroyed explicitly. To access an object, call the getInstance method, which creates a SpeechKit object when called for the first time. This object is destroyed when the app closes.

Nested classes

Methods

voidconfigure(android.content.Context context, String apiKey)

Configuring SpeechKit.

voidconfigure(android.content.Context context, String apiKey, LocationProvider locationProvider)

Configuring SpeechKit (with access to geolocation).

StringgetAPIKey()

Returns the API key.

SpeechKitgetInstance()

Returns a shared instance of the SpeechKit class.

StringgetParameter(String name)

Returns the values of internal SpeechKit library parameters set by the user.

List< String >getSupportedLanguages(String model)

Returns a list of languages that the specified model supports.

StringgetUuid()

Returns the UID used.

StringgetVersion()

Returns the SpeechKit version.

voidsetLogLevel(int logLevel)

Sets the logging level.

voidsetParameter(String name, String value)

Sets internal SpeechKit library parameters.

Fields

intLOG_DEBUG

The most detailed logging level.

intLOG_ERROR

Logging level: errors only.

intLOG_INFO

Logging level: errors, warnings, and notifications about how SpeechKit is operating.

intLOG_WARN

Logging level: errors and warning.

Method descriptions

configure

public void configure (android.content.Context context, String apiKey)

Configuring SpeechKit.

This method must be called before using any of the SpeechKit functionality (before creating instances of the Recognizer class).
Parameters:
context

Application context.

apiKey

The API key provided by Yandex.

Note.

The API key is verified when working with the server (such as during initialization). The key validation process may finish with the error Error.ERROR_API_KEY.

configure

public void configure (android.content.Context context, String apiKey, LocationProvider locationProvider)

Configuring SpeechKit (with access to geolocation).

This method must be called before using any of the SpeechKit functionality (before creating instances of the Recognizer class).
Parameters:
context

Application context.

apiKey

The API key provided by Yandex.

locationProvider

Object that gives the library access to geolocation. Information about the user's current location may be used for determining the most likely hypotheses, such as when using the MAPS language model.

To disable geolocation, pass an empty attribute as the third parameter.
Note.

The API Key is validated when working with the backend (such as during initialization). The key validation process may finish with the error Error.ERROR_API_KEY.

Note.

If SpeechKit was configured by calling a different version of SpeechKit.configure, the default value will be used for working with geolocation.

getAPIKey

public String getAPIKey ()

Returns the API key.

Returns:

The API key.

getInstance

public static SpeechKit getInstance ()

Returns a shared instance of the SpeechKit class.

Returns:

Shared instance of the SpeechKit class.

getParameter

public String getParameter (String name)

Returns the values of internal SpeechKit library parameters set by the user.

Parameters:
name

Name of an internal parameter.

Returns:

Value of an internal parameter.

getSupportedLanguages

public List< String > getSupportedLanguages (String model)

Returns a list of languages that the specified model supports.

Parameters:
model

Model name.

Returns:

List of languages.

getUuid

public String getUuid ()

Returns the UID used.

Returns:

Unique user ID. The UUID must be the same for all requests sent to a particular app on a specific device.

getVersion

public static String getVersion ()

Returns the SpeechKit version.

Returns:

String with the SpeechKit version number.

setLogLevel

public void setLogLevel (int logLevel)

Sets the logging level.

setParameter

public void setParameter (String name, String value)

Sets internal SpeechKit library parameters.

Parameters:
name

Name of an internal parameter.

value

Value of an internal parameter.

Field descriptions

LOG_DEBUG

public static int LOG_DEBUG ()

The most detailed logging level.

The fullest information on how SpeechKit is running.

LOG_ERROR

public static int LOG_ERROR ()

Logging level: errors only.

LOG_INFO

public static int LOG_INFO ()

Logging level: errors, warnings, and notifications about how SpeechKit is operating.

LOG_WARN

public static int LOG_WARN ()

Logging level: errors and warning.