Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Sources/VoiceMemo/Services/Pipeline/TranscriptParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ struct TingwuParser: TranscriptionResultParser {

private func extractText(from item: [String: Any]) -> String {
if let text = item["Text"] as? String, !text.isEmpty { return text }
if let text = item["text"] as? String, !text.isEmpty { return text }
if let words = item["Words"] as? [[String: Any]] {
return words.compactMap { $0["Text"] as? String }.joined()
return words.compactMap { $0["Text"] as? String ?? $0["text"] as? String }.joined()
}
return ""
}

private func extractSpeaker(from item: [String: Any]) -> String? {
if let name = item["SpeakerName"] as? String, !name.isEmpty { return TranscriptFormatHelper.formatSpeaker(name) }
if let name = item["SpeakerName"] as? String, !name.isEmpty { return name }
if let speaker = item["Speaker"] as? String, !speaker.isEmpty { return speaker }
if let id = item["SpeakerId"] ?? item["SpeakerID"] { return TranscriptFormatHelper.formatSpeaker(id) }
return nil
}
Expand Down