feat: align subtitles from first 10 seconds audio

This commit is contained in:
TTlaji committed 2026-06-03 15:10:49 +08:00
1 parent 93e06ca40a
commit 5228765473
11 files changed
+248 -22

No files matched your search

+5 -4
View File
@@ -33,16 +33,17 @@ My first job as an investor was when I was 24 years old,
My first job as an investor was when I was 24 years old,
"""
result = process_subtitles_with_ai(raw, FakeClient())
result = process_subtitles_with_ai(raw, FakeClient(), timestamp_offset_seconds=0.2)
assert "My first job as an investor" in result["subtitle_en_content"]
assert "我第一次做投资人是在 24 岁。" in result["subtitle_zh_content"]
assert result["report"]["duplicate_count"] == 1
assert result["report"]["translation_count"] == 1
assert "00:00:00.872 --> 00:00:04.959" in result["subtitle_en_content"]
assert "00:00:00.872 --> 00:00:04.959" in result["subtitle_zh_content"]
assert "00:00:01.072 --> 00:00:05.159" in result["subtitle_en_content"]
assert "00:00:01.072 --> 00:00:05.159" in result["subtitle_zh_content"]
assert "timestamp_calibrated" in result["report"]
assert result["report"]["timestamp_calibrated"] is False
assert result["report"]["timestamp_calibrated"] is True
assert result["report"]["timestamp_offset_seconds"] == 0.2
if __name__ == "__main__":