From dcd4619d63c0afc9880fe8e36061c78e54bd0d61 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Mon, 6 Jul 2026 14:48:36 +0800 Subject: [PATCH] refactor: update return types in OCR methods to use Keyword instead of OcrResultButton --- module/ocr/ocr.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/ocr/ocr.py b/module/ocr/ocr.py index 2018b40..e23d37b 100644 --- a/module/ocr/ocr.py +++ b/module/ocr/ocr.py @@ -10,6 +10,7 @@ from module.base.decorator import cached_property from module.base.utils import * from module.exception import ScriptError from module.logger import logger +from module.ocr.keyword import Keyword from module.ocr.models import OCR_MODEL, TextSystem from module.ocr.utils import merge_buttons @@ -224,7 +225,7 @@ class Ocr: keyword_classes, lang: str = None, ignore_punctuation=True - ) -> OcrResultButton: + ) -> Keyword: """ Args: image: Image to detect @@ -233,7 +234,7 @@ class Ocr: ignore_punctuation: Returns: - OcrResultButton: Or None if it didn't matched known keywords. + Keyword: Or None if it didn't matched known keywords. """ result = self.ocr_single_line(image) @@ -254,7 +255,7 @@ class Ocr: keyword_classes, lang: str = None, ignore_punctuation=True - ) -> list[OcrResultButton]: + ) -> list[Keyword]: """ Args: image_list: @@ -263,7 +264,7 @@ class Ocr: ignore_punctuation: Returns: - List of matched OcrResultButton. + List of matched Keyword. OCR result which didn't matched known keywords will be dropped. """ results = self.ocr_multi_lines(image_list)