Skip to content

How to get the original text that was detected as an anonymization candidate in the Analyse phase? #925

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

You must be logged in to vote

Hi @storkeu, we have a similar demo website in our samples gallery: https://microsoft.github.io/presidio/samples/python/streamlit/

Programmatically, one can access the detected entity value this way:

from presidio_analyzer import AnalyzerEngine

text="My phone number is 212-555-5555"
analyzer = AnalyzerEngine()

# Call analyzer to get results
results = analyzer.analyze(text=text, language='en')

for result in results:
    print(f"Text: {text[result.start: result.end]} identified as entity {result.entity_type}")

Returning:

Text: 212-555-5555 identified as entity PHONE_NUMBER

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@storkeu
Comment options

Answer selected by SharonHart
Comment options

You must be logged in to vote
3 replies
@omri374
Comment options

@rabbyn
Comment options

@omri374
Comment options

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