Skip to content

Docs: Add YAML and Python example for context-aware recognizers#1710

Merged
omri374 merged 9 commits into
microsoft:mainfrom
MRADULTRIPATHI:fix-context-boost
Sep 6, 2025
Merged

Docs: Add YAML and Python example for context-aware recognizers#1710
omri374 merged 9 commits into
microsoft:mainfrom
MRADULTRIPATHI:fix-context-boost

Conversation

@MRADULTRIPATHI

@MRADULTRIPATHI MRADULTRIPATHI commented Sep 1, 2025

Copy link
Copy Markdown
Contributor

Change Description

This PR updates the analyzer docs to include examples for using context with custom YAML recognizers.
The update clarifies how to define context in YAML and how to apply it in Python with LemmaContextAwareEnhancer.

This helps avoid confusion like in issue #1696 where context in YAML seemed ignored.

Issue reference

Fixes #1696

Checklist

  • I have reviewed the contribution guidelines
  • I have signed the CLA
  • My code/docs update is limited to documentation only
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates

Example (YAML + Python)

See the added example in developing_recognizers.md for loading a DOB recognizer from YAML and applying context boosting in Python.

@MRADULTRIPATHI

Copy link
Copy Markdown
Contributor Author

Hi @maintainers

This PR only updates the docs to add YAML + Python examples for context-aware recognizers.
It’s a small documentation fix aligned with your earlier feedback on #1705 (avoid logic changes, show correct usage).

Since it’s docs-only and clarifies a common misconfiguration (#1696), a quick review/merge would be very helpful

Thanks a lot!

@MRADULTRIPATHI

MRADULTRIPATHI commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

Hi @SharonHart @yuvalyaron maintainers 👋

This PR adds documentation updates with YAML and Python examples for context-aware recognizers.
It’s a documentation-only change, aimed at helping users avoid misconfiguration when defining custom recognizers.
Could you please approve and trigger the workflows so that the CI checks can run?
Thanks a lot for your time and review

@MRADULTRIPATHI

Copy link
Copy Markdown
Contributor Author

Hi @tamirkamara and @omri374

I’ve added a small documentation update with YAML and Python examples for context-aware recognizers to help avoid misconfiguration.
Would you be able to review this PR when you have a chance? Your feedback would be greatly appreciated .

Thank you!

@omri374

omri374 commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator

Hi @MRADULTRIPATHI, thanks for the PR. We have initial documentation for the YAML providers here: https://github.com/microsoft/presidio/blob/main/docs/analyzer/analyzer_engine_provider.md. How about we integrate the context examples there?

@MRADULTRIPATHI

Copy link
Copy Markdown
Contributor Author

Thanks @omri374 for the feedback!
That makes sense — I’ll move the YAML + Python context example into analyzer_engine_provider.md under the YAML providers section so it’s consistent with the existing docs.

Will update the PR accordingly.

@MRADULTRIPATHI

Copy link
Copy Markdown
Contributor Author

Hi @omri374, thanks again for the feedback!
I’ve updated the PR as suggested — the YAML + Python context example has been moved under analyzer_engine_provider.md to align with the existing documentation.
Could you please review the changes at your convenience? If everything looks good, it would be great if we can proceed with merging.

Comment thread docs/analyzer/analyzer_engine_provider.md Outdated
Comment thread docs/analyzer/analyzer_engine_provider.md Outdated
Comment thread docs/analyzer/analyzer_engine_provider.md Outdated
Comment thread docs/analyzer/analyzer_engine_provider.md Outdated
Comment thread docs/analyzer/analyzer_engine_provider.md Outdated
Comment thread docs/analyzer/analyzer_engine_provider.md
MRADULTRIPATHI and others added 2 commits September 4, 2025 18:19
Co-authored-by: Omri Mendels <omri374@users.noreply.github.com>
@MRADULTRIPATHI

Copy link
Copy Markdown
Contributor Author

Hi @omri374,
Thanks for the review and helpful feedback!
I’ve updated the documentation accordingly:
Fixed the code block markers for both YAML and Python examples.
Removed the extra/unnecessary lines.
Added the explicit step to save dob_recognizer.yml before loading, so the example is self-contained and reproducible.
Please let me know if there’s anything else you’d like me to adjust.

@omri374

omri374 commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator

Thanks! Could have been my bad, but the code chunks don't render correctly:

image

@MRADULTRIPATHI

MRADULTRIPATHI commented Sep 4, 2025

Copy link
Copy Markdown
Contributor Author

Hi @omri374,
Thanks a lot for the quick and detailed review 🙏. I’ve updated the docs based on your feedback:
Fixed the YAML and Python code block formatting to render properly.
Verified that the context recognizer example and analyzer engine docs are now consistent.
Please let me know if anything else needs adjustment. Looking forward to your review and hopefully a merge

@omri374

omri374 commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@MRADULTRIPATHI

Copy link
Copy Markdown
Contributor Author

Thanks @omri374 for the approval! All checks have passed, so this PR should be ready to merge.
Appreciate your time and guidance

@MRADULTRIPATHI

Copy link
Copy Markdown
Contributor Author

Hi @microsoft,
This PR has been approved ✅, all checks have passed, and there are no conflicts.
Requesting your help to merge it 🙏.
Thanks a lot!

@MRADULTRIPATHI

MRADULTRIPATHI commented Sep 5, 2025

Copy link
Copy Markdown
Contributor Author

Hi @microsoft, team
Just a gentle reminder
This PR #1710 has already been approved ✅, all checks have passed, and there are no conflicts.
Would it be possible to merge it when you get a chance?
Thanks a lot

@omri374 omri374 merged commit 480e228 into microsoft:main Sep 6, 2025
57 checks passed
prokopidis pushed a commit to prokopidis/presidio that referenced this pull request Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context in recognizer YAML is ignored when scoring matches

2 participants