Skip to content

Commit 90db484

Browse files
committed
Merge branch 'feature/text_analytics_v3.0' of https://github.com/Azure/azure-sdk-for-python into add_text_to_sentence_sentiment
* 'feature/text_analytics_v3.0' of https://github.com/Azure/azure-sdk-for-python: [text analytics] have tests pass (as much as they can) in ci (Azure#11055)
2 parents 3ca5dd6 + 49d5c9b commit 90db484

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,25 @@ class DetectedLanguage(DictMixin):
6969
:param iso6391_name: A two letter representation of the detected
7070
language according to the ISO 639-1 standard (e.g. en, fr).
7171
:type iso6391_name: str
72-
:param score: A confidence score between 0 and 1. Scores close
72+
:param confidence_score: A confidence score between 0 and 1. Scores close
7373
to 1 indicate 100% certainty that the identified language is true.
74-
:type score: float
74+
:type confidence_score: float
7575
"""
7676

7777
def __init__(self, **kwargs):
7878
self.name = kwargs.get("name", None)
7979
self.iso6391_name = kwargs.get("iso6391_name", None)
80-
self.score = kwargs.get("score", None)
80+
self.confidence_score = kwargs.get("confidence_score", None)
8181

8282
@classmethod
8383
def _from_generated(cls, language):
8484
return cls(
85-
name=language.name, iso6391_name=language.iso6391_name, score=language.score
85+
name=language.name, iso6391_name=language.iso6391_name, confidence_score=language.confidence_score
8686
)
8787

8888
def __repr__(self):
8989
return "DetectedLanguage(name={}, iso6391_name={}, score={})" \
90-
.format(self.name, self.iso6391_name, self.score)[:1024]
90+
.format(self.name, self.iso6391_name, self.confidence_score)[:1024]
9191

9292

9393
class RecognizeEntitiesResult(DictMixin):

sdk/textanalytics/azure-ai-textanalytics/tests/testcase.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,20 @@ def __init__(self):
8787
)
8888

8989
def create_resource(self, name, **kwargs):
90-
text_analytics_account = TextAnalyticsTest._TEXT_ANALYTICS_ACCOUNT
91-
92-
return {
93-
'location': 'westus2',
94-
'resource_group': TextAnalyticsTest._RESOURCE_GROUP,
95-
'text_analytics_account': text_analytics_account,
96-
'text_analytics_account_key': TextAnalyticsTest._TEXT_ANALYTICS_KEY,
97-
}
90+
if self.is_live:
91+
return {
92+
'location': 'westus2',
93+
'resource_group': TextAnalyticsTest._RESOURCE_GROUP,
94+
'text_analytics_account': os.environ['AZURE_TEXT_ANALYTICS_ENDPOINT'],
95+
'text_analytics_account_key': os.environ['AZURE_TEXT_ANALYTICS_KEY'],
96+
}
97+
else:
98+
return {
99+
'location': 'westus2',
100+
'resource_group': TextAnalyticsTest._RESOURCE_GROUP,
101+
'text_analytics_account': "https://westus2.ppe.cognitiveservices.azure.com",
102+
'text_analytics_account_key': "fake_key",
103+
}
98104

99105
class TextAnalyticsClientPreparer(AzureMgmtPreparer):
100106
def __init__(self, client_cls, client_kwargs={}, **kwargs):
@@ -129,15 +135,15 @@ def create_text_analytics_client(self, **kwargs):
129135
def text_analytics_account():
130136
test_case = AzureTestCase("__init__")
131137
rg_preparer = ResourceGroupPreparer(random_name_enabled=True, name_prefix='pycog')
132-
text_analytics_preparer = CognitiveServicesAccountPreparer(random_name_enabled=True, name_prefix='pycog', sku='S0')
138+
text_analytics_preparer = CognitiveServicesAccountPreparer(random_name_enabled=True, name_prefix='pycog')
133139

134140
try:
135141
rg_name, rg_kwargs = rg_preparer._prepare_create_resource(test_case)
136142
TextAnalyticsTest._RESOURCE_GROUP = rg_kwargs['resource_group']
137143
try:
138144
text_analytics_name, text_analytics_kwargs = text_analytics_preparer._prepare_create_resource(test_case, **rg_kwargs)
139-
TextAnalyticsTest._TEXT_ANALYTICS_ACCOUNT = os.environ['AZURE_TEXT_ANALYTICS_ENDPOINT'] #text_analytics_kwargs['cognitiveservices_account']
140-
TextAnalyticsTest._TEXT_ANALYTICS_KEY = os.environ['AZURE_TEXT_ANALYTICS_KEY'] # text_analytics_kwargs['cognitiveservices_account_key']
145+
TextAnalyticsTest._TEXT_ANALYTICS_ACCOUNT = text_analytics_kwargs['cognitiveservices_account']
146+
TextAnalyticsTest._TEXT_ANALYTICS_KEY = text_analytics_kwargs['cognitiveservices_account_key']
141147
yield
142148
finally:
143149
text_analytics_preparer.remove_resource(

0 commit comments

Comments
 (0)