Spaces:
Running
Running
Eason Lu
commited on
Commit
•
d104403
1
Parent(s):
d231d79
small fix on regex
Browse filesFormer-commit-id: adb93bd16f5d3ab24916b440bb8c0c85a50e5ff4
- SRT.py +1 -1
- pipeline.py +1 -1
SRT.py
CHANGED
@@ -402,7 +402,7 @@ class SRT_script():
|
|
402 |
for word in keywords:
|
403 |
for i, seg in enumerate(self.segments):
|
404 |
if word in seg.source_text.lower():
|
405 |
-
seg.source_text = re.sub(r"{}(s|es)
|
406 |
# seg.source_text = seg.source_text.lower().replace(word, term_enzh_dict.get(word))
|
407 |
logging.info("replace term: " + word + " --> " + term_enzh_dict.get(word) + " in time stamp {}".format(i+1))
|
408 |
logging.info("source text becomes: " + seg.source_text)
|
|
|
402 |
for word in keywords:
|
403 |
for i, seg in enumerate(self.segments):
|
404 |
if word in seg.source_text.lower():
|
405 |
+
seg.source_text = re.sub(r"{}(s|es)*\s".format(word), "{} ".format(term_enzh_dict.get(word)), seg.source_text, flags=re.IGNORECASE)
|
406 |
# seg.source_text = seg.source_text.lower().replace(word, term_enzh_dict.get(word))
|
407 |
logging.info("replace term: " + word + " --> " + term_enzh_dict.get(word) + " in time stamp {}".format(i+1))
|
408 |
logging.info("source text becomes: " + seg.source_text)
|
pipeline.py
CHANGED
@@ -313,7 +313,7 @@ def main():
|
|
313 |
os.system(f'ffmpeg -i {video_path} -vf "subtitles={RESULT_PATH}/{VIDEO_NAME}/{VIDEO_NAME}_zh.ass" {RESULT_PATH}/{VIDEO_NAME}/{VIDEO_NAME}.mp4')
|
314 |
|
315 |
end_time = time.time()
|
316 |
-
logging.info("Pipeline finished, time duration:{}".format(
|
317 |
|
318 |
if __name__ == "__main__":
|
319 |
main()
|
|
|
313 |
os.system(f'ffmpeg -i {video_path} -vf "subtitles={RESULT_PATH}/{VIDEO_NAME}/{VIDEO_NAME}_zh.ass" {RESULT_PATH}/{VIDEO_NAME}/{VIDEO_NAME}.mp4')
|
314 |
|
315 |
end_time = time.time()
|
316 |
+
logging.info("Pipeline finished, time duration:{}".format(time.strftime("%H:%M:%S", time.gmtime(end_time - start_time))))
|
317 |
|
318 |
if __name__ == "__main__":
|
319 |
main()
|