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(speakers): keep a one-to-one voice nameable past a stray cluster

clementchen738e6ac3011b
diff --git a/Sources/Cicada/SpeakerID.swift b/Sources/Cicada/SpeakerID.swift
index 32b3699..884a7cf 100644
--- a/Sources/Cicada/SpeakerID.swift
+++ b/Sources/Cicada/SpeakerID.swift
@@ -274,7 +274,12 @@ enum SpeakerLabels {
/// way to name it and remember its voiceprint for the next meeting.
static func singleVoice(_ lines: [TranscriptLine]) -> Int? {
let voices = Set(lines.filter { $0.speaker == "them" }.compactMap(\.voice))
- return voices.count == 1 ? voices.first : nil
+ if voices.count == 1 { return voices.first }
+ // A stray breath or a click can make a second one-line voice: still show the one voice
+ // that actually has substantive speech, so a one-to-one call remains nameable.
+ let substantiveVoices = Set(lines.filter { $0.speaker == "them" && substantive($0.src) }
+ .compactMap(\.voice))
+ return substantiveVoices.count == 1 ? substantiveVoices.first : nil
}
/// Line id → 1-based speaker number; lines without one show as 对方.