diff --git a/module/ocr/keyword.py b/module/ocr/keyword.py index 7d78a4793..f77a8f612 100644 --- a/module/ocr/keyword.py +++ b/module/ocr/keyword.py @@ -6,7 +6,7 @@ from typing import ClassVar import module.config.server as server from module.exception import ScriptError -REGEX_PUNCTUATION = re.compile(r'[ ,.\'"“”,。::!!??·•\-—/\\\n\t()\[\]()「」『』【】《》]') +REGEX_PUNCTUATION = re.compile(r'[ ,.\'"“”,。::!!??·•\-—/\\\n\t()\[\]()「」『』【】《》[]]') def parse_name(n): diff --git a/tasks/rogue/blessing.py b/tasks/rogue/blessing.py index de705c5c6..876e3d770 100644 --- a/tasks/rogue/blessing.py +++ b/tasks/rogue/blessing.py @@ -61,18 +61,18 @@ class RogueBuffOcr(Ocr): def after_process(self, result): result = super().after_process(result) - if self.lang == 'ch': + if self.lang == 'cn': replace_pattern_dict = { "蓬失": "蓬矢", "柘弓危失": "柘弓危矢", "飞虹珠?凿?齿": "飞虹诛凿齿", - "天培步危": "天棓步危", + "天[培梧]步危": "天棓步危", "云[摘销锅]?逐步离": "云镝逐步离", "制桑": "制穹桑", "乌号基": "乌号綦", "追摩物": "追孽物", "特月": "狩月", - "彤弓素增?": "彤弓素矰", + "彤弓素.*": "彤弓素矰", "白决射御": "白矢决射御", "苦表": "苦衷", "[沦沧]肌髓": "沦浃肌髓", @@ -260,7 +260,10 @@ class RogueBlessingSelector(RogueSelector): return True def load_filter(self): - keyword = self.ocr_results[0].matched_keyword + try: + keyword = self.ocr_results[0].matched_keyword + except IndexError: + return if not isinstance(keyword, (RogueBlessing, RogueResonance)): return filter_configs = { diff --git a/tasks/rogue/curio.py b/tasks/rogue/curio.py index 8f9c2d75f..977044f3b 100644 --- a/tasks/rogue/curio.py +++ b/tasks/rogue/curio.py @@ -16,10 +16,10 @@ from tasks.rogue.utils import get_regex_from_keyword_name, parse_name CURIO_FILTER_ATTR = tuple() CURIO_ATTR_NAME = 'curio_name' -pattern = get_regex_from_keyword_name(RogueCurio, CURIO_ATTR_NAME) +patt = get_regex_from_keyword_name(RogueCurio, CURIO_ATTR_NAME) CURIO_FILTER_ATTR += (CURIO_ATTR_NAME,) CURIO_FILTER_PRESET = ('random', 'unrecorded') -FILTER_REGEX = re.compile(pattern) +FILTER_REGEX = re.compile(patt) CURIO_FILTER = MultiLangFilter(FILTER_REGEX, CURIO_FILTER_ATTR, CURIO_FILTER_PRESET) @@ -32,6 +32,7 @@ class RogueCurioOcr(Ocr): replace_pattern_dict = { "般": "骰", "漂灭": "湮灭", + "殷子": "骰子", } for pattern, replace in replace_pattern_dict.items(): result = re.sub(pattern, replace, result)