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(linux): Interpreting no longer speaks a bare heading like "翻译结果:" into the meeting

wquguru13e95912813a
diff --git a/linux/cicada/core/speak.py b/linux/cicada/core/speak.py
index 63c8e46..e1ad6fb 100644
--- a/linux/cicada/core/speak.py
+++ b/linux/cicada/core/speak.py
@@ -307,7 +307,11 @@ FILLERS = {"嗯", "啊", "呃", "哦", "唔", "额", "噢", "哎", "um", "uh", "
def filler(text: str) -> bool:
- """Nothing but fillers (嗯, 啊, um, hmm…), whatever the punctuation (the Mac's PressSpeech.filler)."""
+ """Nothing but fillers (嗯, 啊, um, hmm…), whatever the punctuation (the Mac's PressSpeech.filler).
+ A heading with nothing after it ("翻译结果:", "Translation:") is the model's answer to noise, too."""
+ trimmed = text.strip()
+ if 0 < len(trimmed) <= 12 and trimmed[-1] in "::":
+ return True
words = [w for w in re.split(r"[^\w]+|[\d_]+", text.lower()) if w]
return not words or all(w in FILLERS or (len(w) > 1 and len(set(w)) == 1 and w[0] in FILLERS) for w in words)
diff --git a/linux/tests/test_core.py b/linux/tests/test_core.py
index 21bb0b9..9104ae4 100644
--- a/linux/tests/test_core.py
+++ b/linux/tests/test_core.py
@@ -1264,6 +1264,7 @@ class Speaking(Base):
self.assertEqual([], fake.spoken, "nothing sent to the voice")
from cicada.core.speak import filler
self.assertTrue(filler("嗯嗯。") and filler("Um, uh...") and not filler("嗯,好的。") and not filler("OK."))
+ self.assertTrue(filler("翻译结果:") and filler("Translation:") and not filler("我想补充三点:价格、时间和人手。"))
def test_fetches_the_next_voice_while_the_last_one_plays(self):
eng, fake, player = self._engine("ORIGINAL: 你好\nTRANSLATION: Hello")