Skip to content

How to include context words to the pre-existence recognizers #804

Answered by omri374
Idomingog asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Idomingog,

First, let me share an example on how to technically add more context words to existing recognizers. Then, I'll try to answer your questions about addresses and doctor's vs user's name.

Updating / changing the context words of recognizers

To update the context words in a specific recognizer, you can either create a new recognizer, or update an existing one.
This example updates an existing one:

from presidio_analyzer import AnalyzerEngine

analyzer = AnalyzerEngine()
recognizers = analyzer.get_recognizers()

# Finding the one which supports US_PASSPORT

passport_recognizer = [rec for rec in recognizers if "US_PASSPORT" in rec.supported_entities][0]

# Existing list of conte…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Idomingog
Comment options

@omri374
Comment options

Answer selected by Idomingog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants