add chinese subtitles
This commit is contained in:
@@ -7,6 +7,7 @@ struct SentenceBoundary: Identifiable, Equatable, Decodable {
|
||||
let text: String?
|
||||
let language: String?
|
||||
let referenceSpeechDurationMs: Int64?
|
||||
let zhText: String?
|
||||
|
||||
var id: Int { index }
|
||||
|
||||
@@ -15,6 +16,48 @@ struct SentenceBoundary: Identifiable, Equatable, Decodable {
|
||||
case startMs = "start_ms"
|
||||
case endMs = "end_ms"
|
||||
case referenceSpeechDurationMs = "reference_speech_duration_ms"
|
||||
case zhText = "zh_text"
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
index = try container.decode(Int.self, forKey: .index)
|
||||
startMs = try container.decode(Int64.self, forKey: .startMs)
|
||||
endMs = try container.decode(Int64.self, forKey: .endMs)
|
||||
text = try container.decodeIfPresent(String.self, forKey: .text)
|
||||
language = try container.decodeIfPresent(String.self, forKey: .language)
|
||||
referenceSpeechDurationMs = try container.decodeIfPresent(Int64.self, forKey: .referenceSpeechDurationMs)
|
||||
zhText = try container.decodeIfPresent(String.self, forKey: .zhText)
|
||||
}
|
||||
|
||||
init(
|
||||
index: Int,
|
||||
startMs: Int64,
|
||||
endMs: Int64,
|
||||
text: String?,
|
||||
language: String?,
|
||||
referenceSpeechDurationMs: Int64?,
|
||||
zhText: String? = nil
|
||||
) {
|
||||
self.index = index
|
||||
self.startMs = startMs
|
||||
self.endMs = endMs
|
||||
self.text = text
|
||||
self.language = language
|
||||
self.referenceSpeechDurationMs = referenceSpeechDurationMs
|
||||
self.zhText = zhText
|
||||
}
|
||||
|
||||
func withZhText(_ zhText: String?) -> SentenceBoundary {
|
||||
SentenceBoundary(
|
||||
index: index,
|
||||
startMs: startMs,
|
||||
endMs: endMs,
|
||||
text: text,
|
||||
language: language,
|
||||
referenceSpeechDurationMs: referenceSpeechDurationMs,
|
||||
zhText: zhText
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user