Files
presidio/docs
f55bf966ff fix(analyzer): omitted deny_list_score in YAML registry now defaults to 1.0 (#2254)
* fix(analyzer): omitted deny_list_score in YAML registry now defaults to 1.0

CustomRecognizerConfig.deny_list_score defaulted to 0.0 and was always
present in model_dump() output, so RecognizerRegistryProvider (YAML/dict
registry config) passed deny_list_score=0.0 into PatternRecognizer even
when the config said nothing. Any positive score_threshold then filtered
out every deny-list match loaded through the provider, while the same
recognizer built via PatternRecognizer() directly or
RecognizerRegistry.add_pattern_recognizer_from_dict() correctly defaulted
to 1.0.

Changes the field default to None and overrides model_dump() to exclude
None values, matching the existing pattern used by
HuggingFaceRecognizerConfig/GLiNERRecognizerConfig/LangExtractRecognizerConfig
in the same file. Excluding the key entirely (not just setting it to None)
matters here because PatternRecognizer.from_dict() forwards the dumped
dict straight into the constructor via cls(**dict) - passing an explicit
None would set the score to None outright rather than falling back to the
constructor's own default.

Explicit deny_list_score values are unaffected. Behavior change: deny-list
matches from YAML registry configs without an explicit deny_list_score
now score 1.0 instead of 0.0 - called out in docs/analyzer/recognizer_registry_provider.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Simplify: default deny_list_score to 1.0 instead of overriding model_dump

Per review feedback (omri374): defaulting the field itself to 1.0 -
PatternRecognizer's own default - makes the value identical whether the
key is passed explicitly or omitted, so there's no need for the
exclude_none override at all. Drops the model_dump() override entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Pradyoth P <pradyoth0@gmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 08:53:17 +03:00
..
2025-03-18 18:42:46 +02:00
2026-06-28 10:27:33 +03:00
2024-12-29 13:16:29 +02:00
2026-06-28 10:27:33 +03:00
2026-06-28 10:27:33 +03:00