mirror of
https://github.com/PR0M3TH3AN/unredact.git
synced 2026-11-06 13:40:29 +00:00
fix: update score docstring, remove dead SIZE_RANGE, fix unused import
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
1 parent
1b863fdf21
commit
93f4502bfa
2 files changed
+2
-5
No files matched your search
@@ -2,7 +2,7 @@
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from unredact.pipeline.font_detect import _find_font_path, _full_search, _fine_search
|
||||
from unredact.pipeline.font_detect import _find_font_path, _full_search
|
||||
from unredact.pipeline.ocr import OcrChar, OcrLine
|
||||
|
||||
|
||||
|
||||
@@ -19,9 +19,6 @@ CANDIDATE_FONTS: list[str] = [
|
||||
"DejaVu Sans",
|
||||
]
|
||||
|
||||
# Size range to search (in pixels at rendering DPI)
|
||||
SIZE_RANGE = range(20, 80, 2)
|
||||
|
||||
# If the prior's score is within this factor of the best possible score,
|
||||
# keep the prior. This avoids flipping fonts on noisy lines.
|
||||
PRIOR_BIAS = 1.15
|
||||
@@ -48,7 +45,7 @@ class FontMatch:
|
||||
font_name: str
|
||||
font_path: Path
|
||||
font_size: int # in pixels
|
||||
score: float # lower is better (mean absolute error in px)
|
||||
score: float # higher is better (pixel overlap, 0.0-1.0)
|
||||
|
||||
def to_pil_font(self) -> ImageFont.FreeTypeFont:
|
||||
return ImageFont.truetype(str(self.font_path), self.font_size)
|
||||
|
||||
Reference in new issue
Block a user