mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-10-11 00:22:05 +00:00
feat: add KeywordDigitCounter class for filtering digit counters in OCR results
This commit is contained in:
@@ -201,3 +201,18 @@ class Keyword:
|
||||
|
||||
# Not found
|
||||
raise ScriptError(f'Cannot find a {cls.__name__} instance that matches "{name}"')
|
||||
|
||||
|
||||
class KeywordDigitCounter(Keyword):
|
||||
"""
|
||||
A fake Keyword class to filter digit counters in ocr results
|
||||
OcrResultButton.match_keyword will be a str
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def find(cls, name, lang: str = None, ignore_punctuation=True):
|
||||
from module.ocr.ocr import DigitCounter
|
||||
if DigitCounter.is_format_matched(name):
|
||||
return name
|
||||
else:
|
||||
raise ScriptError
|
||||
|
||||
Reference in New Issue
Block a user