continue fixing

This commit is contained in:
2026-08-26 11:22:55 +08:00
parent a6297e2f9f
commit b1d3a3bd5a
5 changed files with 169 additions and 31 deletions

View File

@@ -1208,16 +1208,29 @@ class MainActivity : Activity() {
"{\"sentence_index\":$it}"
}
text("segments", payload)
val scores = dubSegments.keys.sorted().map { index ->
val scores = dubSegments.keys.sorted().mapNotNull { index ->
latestScores[index]
}.filterNotNull().joinToString(",", "[", "]") { score ->
?.let { score -> index to score }
}.joinToString(",", "[", "]") { (index, score) ->
buildString {
append("{\"sentence_index\":")
append(score.sentenceIndex)
append(index)
if (score.overallScore != null) {
append(",\"overall_score\":")
append(score.overallScore)
}
listOf(
"content_score" to score.contentScore,
"fluency_score" to score.fluencyScore,
"duration_score" to score.durationScore,
"pause_score" to score.pauseScore,
"speech_rate_score" to score.speechRateScore,
).forEach { (name, value) ->
value?.let {
append(",\"$name\":")
append(it)
}
}
score.recognizedText?.let { text ->
append(",\"recognized_text\":\"")
append(text.replace("\\", "\\\\").replace("\"", "\\\""))