Skip to content

Commit

Permalink
Support ASR v1.9 #2465
Browse files Browse the repository at this point in the history
* Append epd param at ASR.Recognize event
  • Loading branch information
sangho.lee authored and shshshl09 committed Mar 15, 2024
1 parent d97320d commit 5b64fe7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DefaultASRAgent(
private const val TAG = "DefaultASRAgent"

const val NAMESPACE = "ASR"
val VERSION = Version(1,8)
val VERSION = Version(1,9)

const val NAME_EXPECT_SPEECH = "ExpectSpeech"
const val NAME_RECOGNIZE = "Recognize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ data class AsrRecognizeEventPayload(
private val encoding: String? = null,
private val wakeup: PayloadWakeup? = null,
private val timeout: Timeout? = null,
private val epd: EndPointDetectorParam? = null,
private val service: JsonObject? = null,
private val requestType: RequestType? = null
) {
Expand Down Expand Up @@ -106,6 +107,14 @@ data class AsrRecognizeEventPayload(
})
}

epd?.let {
add("epd", JsonObject().apply {
addProperty("timeoutMilliseconds", it.timeoutInSeconds * 1000L)
addProperty("silenceIntervalInMilliseconds", it.pauseLengthInMilliseconds)
addProperty("maxSpeechDurationMilliseconds", it.maxDurationInSeconds * 1000L)
})
}

service?.let {
add("service", it)
}
Expand All @@ -114,4 +123,4 @@ data class AsrRecognizeEventPayload(
addProperty("requestType", it.name)
}
}.toString()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class DefaultClientSpeechRecognizer(
endpointing = AsrRecognizeEventPayload.ENDPOINTING_CLIENT,
encoding = if (enablePartialResult) AsrRecognizeEventPayload.ENCODING_PARTIAL else AsrRecognizeEventPayload.ENCODING_COMPLETE,
wakeup = payloadWakeup,
epd = epdParam,
service = jsonService,
requestType = requestType
).toJsonString()
Expand Down

0 comments on commit 5b64fe7

Please sign in to comment.