Skip to content

ORG Recognizer - Rule-based - Difficulties to set up #1121

Closed Answered by LSD-98
LSD-98 asked this question in Q&A
Discussion options

You must be logged in to vote

Found the solution by exploring the code files, and notably spacyrecognizer.py

Here is the code that works in case it helps anyone :

from presidio_analyzer import AnalyzerEngine
from presidio_analyzer.predefined_recognizers import SpacyRecognizer

# Setting up Org_Recognizer & adding it to the analyzer
Entities = ["ORGANIZATION"]
OrgRecognizer = SpacyRecognizer(supported_language="en",supported_entities=Entities, ner_strength=0.85)
analyzer=AnalyzerEngine()

analyzer.registry.add_recognizer(OrgRecognizer)
analyzer.get_supported_entities()

# Test
Text = "Mark works at Microsoft and Google and Apple at the same time !"
results = analyzer.analyze(Text, language= 'en')
print(results)

Now I …

Replies: 1 comment 2 replies

Comment options

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

@LSD-98
Comment options

Answer selected by LSD-98
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