mirror of
https://github.com/PR0M3TH3AN/unredact.git
synced 2026-10-27 08:40:29 +00:00
feat: wire dictionary full-name solver into solve endpoint
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
1 parent
7b0802d005
commit
c04dc589f4
1 file changed
+22
-1
+22
-1
@@ -21,7 +21,7 @@ from unredact.pipeline.font_detect import CANDIDATE_FONTS, _find_font_path
|
||||
from unredact.pipeline.analyze_page import analyze_page
|
||||
from unredact.pipeline.detect_redactions import spot_redaction
|
||||
from unredact.pipeline.solver import build_constraint, SolveResult
|
||||
from unredact.pipeline.dictionary import DictionaryStore, solve_dictionary
|
||||
from unredact.pipeline.dictionary import DictionaryStore, solve_dictionary, solve_full_name_dictionary
|
||||
from unredact.pipeline.word_filter import _get_emails
|
||||
from unredact.pipeline.width_table import build_width_table, CHARSETS
|
||||
|
||||
@@ -363,6 +363,27 @@ async def solve(req: SolveRequest):
|
||||
"source": "emails",
|
||||
})
|
||||
|
||||
# Full-name dictionary solve (associate names)
|
||||
if use_full_name and not _active_solves.get(solve_id):
|
||||
fn_results = solve_full_name_dictionary(
|
||||
font, req.gap_width_px, req.tolerance_px,
|
||||
req.left_context, req.right_context,
|
||||
uppercase_only=(charset_name == "full_name_caps"),
|
||||
)
|
||||
for r in fn_results:
|
||||
if _active_solves.get(solve_id):
|
||||
break
|
||||
if r.text in found_texts:
|
||||
continue
|
||||
found_texts.add(r.text)
|
||||
yield json.dumps({
|
||||
"status": "match",
|
||||
"text": r.text,
|
||||
"width_px": round(r.width, 2),
|
||||
"error_px": round(r.error, 2),
|
||||
"source": "names",
|
||||
})
|
||||
|
||||
if req.mode in ("enumerate", "both") and not _active_solves.get(solve_id):
|
||||
# Build payload and call Rust solver (streaming SSE)
|
||||
if use_full_name:
|
||||
|
||||
Reference in new issue
Block a user