mirror of
https://github.com/m-bain/whisperX.git
synced 2025-07-01 18:17:27 -04:00
@ -213,6 +213,7 @@ def cli():
|
|||||||
results.append((result, input_audio_path))
|
results.append((result, input_audio_path))
|
||||||
# >> Write
|
# >> Write
|
||||||
for result, audio_path in results:
|
for result, audio_path in results:
|
||||||
|
result["language"] = align_language
|
||||||
writer(result, audio_path, writer_args)
|
writer(result, audio_path, writer_args)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -123,6 +123,7 @@ TO_LANGUAGE_CODE = {
|
|||||||
"castilian": "es",
|
"castilian": "es",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LANGUAGES_WITHOUT_SPACES = ["ja", "zh"]
|
||||||
|
|
||||||
system_encoding = sys.getdefaultencoding()
|
system_encoding = sys.getdefaultencoding()
|
||||||
|
|
||||||
@ -283,7 +284,10 @@ class SubtitlesWriter(ResultWriter):
|
|||||||
sstart, ssend, speaker = _[0]
|
sstart, ssend, speaker = _[0]
|
||||||
subtitle_start = self.format_timestamp(sstart)
|
subtitle_start = self.format_timestamp(sstart)
|
||||||
subtitle_end = self.format_timestamp(ssend)
|
subtitle_end = self.format_timestamp(ssend)
|
||||||
subtitle_text = " ".join([word["word"] for word in subtitle])
|
if result["language"] in LANGUAGES_WITHOUT_SPACES:
|
||||||
|
subtitle_text = "".join([word["word"] for word in subtitle])
|
||||||
|
else:
|
||||||
|
subtitle_text = " ".join([word["word"] for word in subtitle])
|
||||||
has_timing = any(["start" in word for word in subtitle])
|
has_timing = any(["start" in word for word in subtitle])
|
||||||
|
|
||||||
# add [$SPEAKER_ID]: to each subtitle if speaker is available
|
# add [$SPEAKER_ID]: to each subtitle if speaker is available
|
||||||
|
Reference in New Issue
Block a user