Spaces:
Sleeping
Sleeping
Eason Lu
commited on
Commit
·
dab2aaf
1
Parent(s):
9ed44bb
regex replace
Browse filesFormer-commit-id: 6c1f8d43c7faf4dbb3392538f31ddbd7eca16d13
SRT.py
CHANGED
@@ -402,7 +402,8 @@ 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 =
|
|
|
406 |
logging.info("replace term: " + word + " --> " + term_enzh_dict.get(word) + " in time stamp {}".format(i+1))
|
407 |
logging.info("source text becomes: " + seg.source_text)
|
408 |
|
|
|
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)*".format(word), 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)
|
409 |
|