Class PhraseSpotter
ru.yandex.speechkit
public class PhraseSpotter
Class for voice activation.
Voice activation technology allows detecting specific phrases in an audio stream. The list of phrases can be found in the voice activation model. Phrase detection can be performed continuously. It does not require an internet connection, all computations are performed on the device.
The PhraseSpotter class contains methods for importing the prepare () and exporting the destroy () model, starting () or stopping () phrase detection.
An object of the PhraseSpotter class uses android.os.Handler for notifying subscribed listeners (PhraseSpotterListener). Therefore, listeners can only be created in a stream that has android.os.Looper, otherwise an exception will be thrown.
Nested Classes
class | PhraseSpotter.Builder |
class | PhraseSpotter.Builder |
Methods
synchronized void | destroy() | Explicitly releases resources used by the component. |
void | finalize() | |
AudioSource | getAudioSource() | Returns the audio source. |
String | getModelPath() | Returns the path to the voice activation model. |
boolean | isLoggingEnabled() | Returns the audio logging flag. |
synchronized void | prepare() | Prepares an object of the PhraseSpotter class for recognition of phrases from the voice activation model. |
synchronized void | start() | Starts an object of the PhraseSpotter class. |
synchronized void | stop() | Stops an object of the PhraseSpotter class asynchronously. |
String | toString() |
synchronized void | destroy() | Explicitly releases resources used by the component. |
void | finalize() | |
AudioSource | getAudioSource() | Returns the audio source. |
String | getModelPath() | Returns the path to the voice activation model. |
boolean | isLoggingEnabled() | Returns the audio logging flag. |
synchronized void | prepare() | Prepares an object of the PhraseSpotter class for recognition of phrases from the voice activation model. |
synchronized void | start() | Starts an object of the PhraseSpotter class. |
synchronized void | stop() | Stops an object of the PhraseSpotter class asynchronously. |
String | toString() |
Method Detail
destroy
public synchronized void destroy ()
Explicitly releases resources used by the component.
Once the resources are released, no correct operation of the PhraseSpotter class object is possible.finalize
public void finalize ()
getAudioSource
public AudioSource getAudioSource ()
Returns the audio source.
Returns:
An object of the AudioSource class.
getModelPath
public String getModelPath ()
Returns the path to the voice activation model.
Returns:
Path to the voice activation model.
isLoggingEnabled
public boolean isLoggingEnabled ()
Returns the audio logging flag.
Returns:
Audio logging flag.
prepare
public synchronized void prepare ()
Prepares an object of the PhraseSpotter class for recognition of phrases from the voice activation model.
Prepares for speech recognition in advance. If the method is not called explicitly, it is called automatically in the start () method. Asynchronous execution.We recommend that you call this method before running an object of the PhraseSpotter class.
start
public synchronized void start ()
Starts an object of the PhraseSpotter class.
The method runs asynchronously, the onPhraseSpotterStarted(PhraseSpotter) callback is invoked when recording starts.stop
public synchronized void stop ()
Stops an object of the PhraseSpotter class asynchronously.
The method does not load the model from memory and the object can be started again.If PhraseSpotter is required only while Activity is running, don't forget to stop it using the onPause()
method of the Activity
system class.
toString
public String toString ()