Fix for prior uppercase mod fix

pull/2887/head v1.5.2-beta.30
JayZed 1 month ago committed by GitHub
parent 2a330f63dc
commit 31fe371782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -118,7 +118,7 @@ class SubtitleModifications(object):
identifier, self.language)
continue
if mod_cls.only_uppercase and not self.mostly_uppercase:
if mod_cls.mostly_uppercase and not self.mostly_uppercase:
if self.debug:
logger.debug("Skipping %s, because the subtitle isn't all uppercase", identifier)
continue

@ -19,7 +19,7 @@ class SubtitleModification(object):
order = None
modifies_whole_file = False # operates on the whole file, not individual entries
apply_last = False
only_uppercase = False
mostly_uppercase = False
pre_processors = []
processors = []
post_processors = []

@ -175,7 +175,7 @@ class FixUppercase(SubtitleModification):
modifies_whole_file = True
exclusive = True
order = 41
only_uppercase = True
mostly_uppercase = True
apply_last = True
long_description = "Some subtitles are in all-uppercase letters. This at least makes them readable."

@ -73,7 +73,7 @@ class HearingImpaired(SubtitleTextModification):
# all caps line (at least 4 consecutive uppercase chars)
NReProcessor(re.compile(r'(?u)(^(?=.*[A-ZÀ-Ž&+]{4,})[A-ZÀ-Ž-_\s&+]+$)'), "", name="HI_all_caps",
supported=lambda p: not p.only_uppercase),
supported=lambda p: not p.mostly_uppercase),
# remove MAN:
NReProcessor(re.compile(r'(?suxi)(\b(?:WO)MAN:\s*)'), "", name="HI_remove_man"),
@ -83,7 +83,7 @@ class HearingImpaired(SubtitleTextModification):
# all caps at start before new sentence
NReProcessor(re.compile(r'(?u)^(?=[A-ZÀ-Ž]{4,})[A-ZÀ-Ž-_\s]+\s([A-ZÀ-Ž][a-zà-ž].+)'), r"\1",
name="HI_starting_upper_then_sentence", supported=lambda p: not p.only_uppercase),
name="HI_starting_upper_then_sentence", supported=lambda p: not p.mostly_uppercase),
]
post_processors = empty_line_post_processors

@ -41,7 +41,7 @@ class FixOCR(SubtitleTextModification):
# don't modify stuff inside quotes
#NReProcessor(re.compile(r'(?u)(^[^"\'’ʼ❜‘‛”“‟„]*(?<=[A-ZÀ-Ž]{3})[A-ZÀ-Ž-_\s0-9]+)'
# r'(["\'’ʼ❜‘‛”“‟„]*[.,‚،⹁、;]+)(\s*)(?!["\'’ʼ❜‘‛”“‟„])'),
# r"\1:\3", name="OCR_fix_HI_colons", supported=lambda p: not p.only_uppercase),
# r"\1:\3", name="OCR_fix_HI_colons", supported=lambda p: not p.mostly_uppercase),
# fix F'bla
NReProcessor(re.compile(r'(?u)(\bF)(\')([A-zÀ-ž]*\b)'), r"\1\3", name="OCR_fix_F"),
WholeLineProcessor(self.data_dict["WholeLines"], name="OCR_replace_line"),

Loading…
Cancel
Save