知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
fix: Interpreting no longer speaks a bare heading like "翻译结果:" into the meeting
wquguruf53c13637a08
diff --git a/Sources/Cicada/SpeakEngine.swift b/Sources/Cicada/SpeakEngine.swiftindex e7caa02..9ed7f70 100644--- a/Sources/Cicada/SpeakEngine.swift+++ b/Sources/Cicada/SpeakEngine.swift@@ -1087,6 +1087,10 @@ enum PressSpeech {static func filler(_ text: String) -> Bool {let words = text.lowercased().split { !$0.isLetter }.map(String.init)guard !words.isEmpty else { return true }+ // A heading with nothing after it ("翻译结果:", "Translation:"): Ming's answer to the meeting's+ // noise in a hands-free stretch nobody spoke in, not a sentence.+ let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)+ if let last = trimmed.last, "::".contains(last), trimmed.count <= 12 { return true }return words.allSatisfy { w in fillers.contains(w) || (w.count > 1 && Set(w).count == 1 && fillers.contains(String(w.first!))) }}static let fillers: Set<String> = ["嗯", "啊", "呃", "哦", "唔", "额", "噢", "哎", "um", "uh", "hmm", "hm", "mm", "mhm", "ah", "oh", "er", "えー", "あの", "음", "어"]diff --git a/Tests/CicadaTests/PressSpeechTests.swift b/Tests/CicadaTests/PressSpeechTests.swiftindex 62d3b37..b24599e 100644--- a/Tests/CicadaTests/PressSpeechTests.swift+++ b/Tests/CicadaTests/PressSpeechTests.swift@@ -45,6 +45,10 @@ import Testing#expect(PressSpeech.filler("嗯。"))#expect(PressSpeech.filler("嗯嗯"))#expect(PressSpeech.filler("Um, uh..."))+ #expect(PressSpeech.filler("翻译结果:"))+ #expect(PressSpeech.filler("Translation:"))+ #expect(!PressSpeech.filler("价格方面我需要先和财务确认一下。"))+ #expect(!PressSpeech.filler("我想补充三点:价格、时间和人手。"))#expect(!PressSpeech.filler("嗯,好的。"))#expect(!PressSpeech.filler("OK."))}