Package com.keenresearch.keenasr
Class KASRResponse
java.lang.Object
com.keenresearch.keenasr.KASRResponse
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 Summary
Modifier and TypeMethodDescriptionfinal String
final String
final KASRResult
final String
final String
final float
final boolean
final String
getJson()
final String
final String
final float
final String
final ZonedDateTime
final Boolean
Save audio file in the directory passed via directory input variable.final Boolean
Save json file in the directory passed via directory input variable.
-
Method Details
-
getAsrResult
- Returns:
- An instance of KASRResult, which contains ASR result for this response
-
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
- Returns:
- LocalDateTime object that specifies the date/time when this response was created (in current device timezone).
-
getResponseId
- Returns:
- Unique identifier of this response
-
getDecodingGraphName
- Returns:
- String representing decoding graph name that was used when creating this response
-
getAsrBundleName
- Returns:
- String object representing the name of the ASR Bundle that was used to initialize the recognizer.
-
getSdkVersion
- Returns:
- String object with the version of KeenASR SDK.
-
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
- 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
- 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
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 viagetAudioFilename()
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
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.
-