Class KASRResponse

java.lang.Object
com.keenresearch.keenasr.KASRResponse

public class KASRResponse extends Object
KASRResponse contains various metadata related to the single interaction with the speech recognition system, from calling startListening until the recognizer stopped listening. It is provided to the application via onFinalResponse callback method.
  • Method Details

    • getAsrResult

      public final KASRResult getAsrResult()
      Returns:
      An instance of KASRResult, which contains ASR result for this response
    • getJson

      public final String getJson()
      Returns:
      String object with JSON representation of the response
    • getEchoCancellation

      public final boolean getEchoCancellation()
      Returns:
      True if echo cancellation was set to true, false otherwise
    • getStartTime

      public final ZonedDateTime getStartTime()
      Returns:
      LocalDateTime object that specifies the date/time when this response was created (in current device timezone).
    • getResponseId

      public final String getResponseId()
      Returns:
      Unique identifier of this response
    • getDecodingGraphName

      public final String getDecodingGraphName()
      Returns:
      String representing decoding graph name that was used when creating this response
    • getAsrBundleName

      public final String getAsrBundleName()
      Returns:
      String object representing the name of the ASR Bundle that was used to initialize the recognizer.
    • getSdkVersion

      public final String getSdkVersion()
      Returns:
      String object with the version of KeenASR SDK.
    • getAppBundleId

      public final String getAppBundleId()
      Returns:
      String object with the bundleID/packageName of the app that created the response.
    • getSampleRate

      public final float getSampleRate()
      Returns:
      sampling rate (in Hertz) with which the audio was captured.
    • getDuration

      public final float getDuration()
      Returns:
      Duration of the response in seconds.
    • getAudioFilename

      public final String getAudioFilename()
      Returns:
      Filename of the audio file that contains audio that corresponds to this response. Filename will typically be in the format responseID.wav. This value is relevant only if you used saveAudio(java.io.File) method.
    • getJsonFilename

      public final String getJsonFilename()
      Returns:
      Filename of the JSON file that contains information relevant to this response. Filename will typically be in the format responseID.json. This value is relevant only if you use saveJson(java.io.File) method.
    • saveAudio

      public final Boolean saveAudio(File directory)
      Save audio file in the directory passed via directory input variable. It is developer responsibility to discard the file eventually and free the disk space. The file with name obtained via getAudioFilename() will be saved in the directory passed to this method.
      Parameters:
      directory - File object pointing to the directory in which to save the audio file.
      Returns:
      True if the file was successfully saved, false otherwise. This method will typically fail if the directory is not writable or if there is not enough disk space to save the file.
    • saveJson

      public final Boolean saveJson(File directory)
      Save json file in the directory passed via directory input variable. It is developer responsibility to discard the file eventually and free disk space. The file with name obtained via KASRResponse#getJsonFilename} will be saved in the directory passed to this method.
      Parameters:
      directory - File object pointing to the directory in which to save the JSON file.
      Returns:
      True if the file was successfully saved, false otherwise. This method will typically fail if the directory is not writable or if there is not enough disk space to save the file.