Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix(android): Interpreting no longer speaks a bare heading like "翻译结果:" into the meeting

wquguru2bb0834ffbdd
diff --git a/android/cli/src/main/kotlin/cicada/cli/Tests.kt b/android/cli/src/main/kotlin/cicada/cli/Tests.kt
index 7c485b6..e232244 100644
--- a/android/cli/src/main/kotlin/cicada/cli/Tests.kt
+++ b/android/cli/src/main/kotlin/cicada/cli/Tests.kt
@@ -1138,6 +1138,7 @@ object Tests {
engine.stop()
} finally { LingClient.spacing = old }
check(PressSpeech.filler("嗯嗯。") && PressSpeech.filler("Um, uh...") && !PressSpeech.filler("嗯,好的。") && !PressSpeech.filler("OK."), "fillers")
+ check(PressSpeech.filler("翻译结果:") && PressSpeech.filler("Translation:") && !PressSpeech.filler("我想补充三点:价格、时间和人手。"), "a bare heading is no sentence")
}
// MARK: 说话人识别 (linux/tests/test_core.py › Speakers)
diff --git a/android/core/src/main/kotlin/cicada/ListenEngine.kt b/android/core/src/main/kotlin/cicada/ListenEngine.kt
index 7adbd54..46f3553 100644
--- a/android/core/src/main/kotlin/cicada/ListenEngine.kt
+++ b/android/core/src/main/kotlin/cicada/ListenEngine.kt
@@ -548,6 +548,9 @@ object PressSpeech {
/** Nothing but fillers (嗯, 啊, um, hmm…), whatever the punctuation. */
fun filler(text: String): Boolean {
+ // A heading with nothing after it ("翻译结果:", "Translation:"): the model's answer to noise, not a sentence.
+ val trimmed = text.trim()
+ if (trimmed.length in 1..12 && trimmed.last() in "::") return true
val words = text.lowercase().split(Regex("[^\\p{L}]+")).filter { it.isNotEmpty() }
return words.isEmpty() || words.all { w -> w in fillers || (w.length > 1 && w.toSet().size == 1 && w.substring(0, 1) in fillers) }
}