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

wquguru598ea2c87cfc
diff --git a/windows/src/Cicada.Core/Speak.cs b/windows/src/Cicada.Core/Speak.cs
index c7002be..4bcc334 100644
--- a/windows/src/Cicada.Core/Speak.cs
+++ b/windows/src/Cicada.Core/Speak.cs
@@ -350,6 +350,9 @@ public static class PressSpeech
/// Nothing but fillers (嗯, 啊, um, hmm…), whatever the punctuation.
public static bool Filler(string text)
{
+ // A heading with nothing after it ("翻译结果:", "Translation:"): the model's answer to noise, not a sentence.
+ var trimmed = text.Trim();
+ if (trimmed.Length is > 0 and <= 12 && (trimmed.EndsWith(':') || trimmed.EndsWith(':'))) return true;
var words = System.Text.RegularExpressions.Regex.Split(text.ToLowerInvariant(), @"[^\p{L}]+").Where(w => w.Length > 0).ToList();
return words.Count == 0 || words.All(w => Fillers.Contains(w) || (w.Length > 1 && w.Distinct().Count() == 1 && Fillers.Contains(w[0].ToString())));
}
diff --git a/windows/tests/Cicada.Tests/Program.cs b/windows/tests/Cicada.Tests/Program.cs
index e6fa832..47fc491 100644
--- a/windows/tests/Cicada.Tests/Program.cs
+++ b/windows/tests/Cicada.Tests/Program.cs
@@ -1694,6 +1694,7 @@ static class Tests
}
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");
}
public static void EchoIsDroppedOnlyFromThePlainMic()