知了 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: with the mic on, a table speaking mostly short sentences is no longer left out of the whole meeting
wqugurub7b28caf063c
diff --git a/Sources/Cicada/LanguageDetector.swift b/Sources/Cicada/LanguageDetector.swiftindex f7f0885..c623759 100644--- a/Sources/Cicada/LanguageDetector.swift+++ b/Sources/Cicada/LanguageDetector.swift@@ -36,6 +36,14 @@ enum LanguageDetector {score: score(conf: heard.confidence, chars: heard.letters, text: heard.text, lang: lang))}+ /// A clip in which no model wrote more than a short word (the room before anyone speaks, a+ /// cough, a two-character fragment of a sentence) says nothing about the language. Counted as+ /// unsure, two of them held a room's lines, and one between two sure answers kept them held:+ /// a table speaking short Chinese sentences lost a whole meeting that way.+ static func saysNothing(_ ranked: [Candidate]) -> Bool {+ ranked.count >= 2 && ranked.allSatisfy { $0.chars <= 3 }+ }+static func score(conf: Double, chars: Int, text: String, lang: Lang) -> Double {guard chars > 0 else { return 0 }// Very short output means the model mostly heard noise.diff --git a/Sources/Cicada/ListenEngine.swift b/Sources/Cicada/ListenEngine.swiftindex 1e4f9f6..0202078 100644--- a/Sources/Cicada/ListenEngine.swift+++ b/Sources/Cicada/ListenEngine.swift@@ -898,6 +898,10 @@ final class ListenEngine {private func applyDetection(_ ranked: [LanguageDetector.Candidate]) {guard let best = ranked.first else { return }+ if LanguageDetector.saysNothing(ranked) {+ if !languageConfirmed || mismatch { needsDetection = true }+ return+ }if ranked.count == 1 {// The right model is ≥0.85 sure; English heard by a French model scored 0.12.guard best.lang == activeLang, best.confidence >= 0.6, best.score >= 0.6 else {diff --git a/Tests/CicadaTests/LanguageTests.swift b/Tests/CicadaTests/LanguageTests.swiftindex aeafefe..c957a33 100644--- a/Tests/CicadaTests/LanguageTests.swift+++ b/Tests/CicadaTests/LanguageTests.swift@@ -30,6 +30,21 @@ import Testing#expect(LanguageDetector.score(conf: 0.9, chars: 3, text: "abc", lang: english) == 0.45)}+ @Test func aClipWithNextToNothingWrittenSaysNothing() {+ let zh = sourceLanguages.first { $0.code == "zh-CN" }!+ func c(_ lang: Lang, _ chars: Int, _ score: Double) -> LanguageDetector.Candidate {+ .init(lang: lang, confidence: score, chars: chars, text: "", score: score)+ }+ // The room before anyone spoke, and a two-character fragment.+ #expect(LanguageDetector.saysNothing([c(zh, 3, 0.09), c(english, 0, 0)]))+ #expect(LanguageDetector.saysNothing([c(zh, 2, 0.26), c(japanese, 0, 0)]))+ // A short sentence, and Chinese that the English model writes out as words.+ #expect(!LanguageDetector.saysNothing([c(zh, 7, 0.86), c(english, 0, 0)]))+ #expect(!LanguageDetector.saysNothing([c(zh, 3, 0.44), c(english, 10, 0.2)]))+ // One model only: its answer still decides.+ #expect(!LanguageDetector.saysNothing([c(zh, 2, 0.26)]))+ }+@Test func cjkModelWritingLatinIsPenalised() {let latin = "hello there everyone"let native = "こんにちは皆さん"diff --git a/site/changelog.json b/site/changelog.jsonindex fb64f6f..35fcb39 100644--- a/site/changelog.json+++ b/site/changelog.json@@ -6,6 +6,14 @@"summary": "刚开完会就换 AI 服务时,设置里不再把连不上的新服务显示成已连接;长会议生成完整纪要时,不再丢掉某个话题;AI 服务一直出错时会提示;Windows、Linux、Android 上开头轻声的一句短话不再被漏掉;真实麦克风和虚拟麦克风格式不同时,按住说话不再闪退。","image": null,"items": [+ {+ "kind": "fixed",+ "platforms": [+ "mac"+ ],+ "title": "打开麦克风后,会议室里的人说的多是短句时,不再整场一句都没记下。",+ "text": "开头的静音或半句两三个字的片段不再被当成“听不出是什么语言”,桌边的话照常出字幕。"+ },{"kind": "new","platforms": [