File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
presidio_evaluator/models Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+ import warnings
12from typing import List , Optional , Dict
23
34from presidio_evaluator import InputSample , span_to_tag
45from presidio_evaluator .models import BaseModel
5- from azure .ai .textanalytics import TextAnalyticsClient
6- from azure .core .credentials import AzureKeyCredential
6+
7+ try :
8+ from azure .ai .textanalytics import TextAnalyticsClient
9+ from azure .core .credentials import AzureKeyCredential
10+ except ImportError :
11+ TextAnalyticsClient = None
12+ AzureKeyCredential = None
713
814
915class TextAnalyticsWrapper (BaseModel ):
@@ -31,11 +37,22 @@ def __init__(
3137 labeling_scheme = labeling_scheme ,
3238 entity_mapping = entity_mapping ,
3339 )
40+
41+ warnings .warn (
42+ f"{ self .__class__ .__name__ } is deprecated and will be removed in a future version."
43+ f"Please use the TextAnalyticsRecognizer within Presidio Analyzer instead." ,
44+ DeprecationWarning ,
45+ stacklevel = 2 ,
46+ )
47+
3448 self .score_threshold = score_threshold
3549 self .language = language
3650 self .ta_key = ta_key
3751 self .ta_endpoint = ta_endpoint
3852
53+ if not TextAnalyticsClient :
54+ raise ImportError ("azure.ai.textanalytics is not installed" )
55+
3956 if not ta_client :
4057 ta_client = self .__authenticate_client (ta_key , ta_endpoint )
4158 self .ta_client = ta_client
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " presidio_evaluator"
3- version = " 0.2.2 "
3+ version = " 0.2.3 "
44description = " "
55authors = [" Microsoft" ]
66readme = " README.md"
@@ -21,7 +21,6 @@ requests = "^2.25"
2121xmltodict = " ^0.12.0"
2222python-dotenv = " ^1.0.0"
2323plotly = " ^5.24.0"
24- azure-ai-textanalytics = " ^5.3.0"
2524
2625# optional dependencies for the different NLP approaches
2726[tool .poetry .group .ner ]
@@ -31,6 +30,7 @@ optional=true
3130flair = " ^0.14.0"
3231spacy_stanza = " ^1.0.0"
3332spacy_huggingface_pipelines = " ^0.0.4"
33+ azure-ai-textanalytics = " ^5.3.0"
3434
3535
3636[tool .poetry .group .dev .dependencies ]
You can’t perform that action at this time.
0 commit comments