Skip to content

Commit 60f4469

Browse files
authored
[text analytics] merging feature branch into master (#11632)
1 parent adf6471 commit 60f4469

File tree

376 files changed

+4295
-3139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

376 files changed

+4295
-3139
lines changed

sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
# Change Log azure-ai-textanalytics
22

3-
## 1.0.0b5 (Unreleased)
3+
## 1.0.0b6 (2020-05-27)
44

5+
**New features**
6+
- We now have a `warnings` property on each document-level response object returned from the endpoints. It is a list of `TextAnalyticsWarning`s.
7+
- Added `text` property to `SentenceSentiment`
8+
9+
**Breaking changes**
10+
- Now targets only the service's v3.0 API, instead of the v3.0-preview.1 API
11+
- `score` attribute of `DetectedLanguage` has been renamed to `confidence_score`
12+
- Removed `grapheme_offset` and `grapheme_length` from `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`
13+
- `TextDocumentStatistics` attribute `grapheme_count` has been renamed to `character_count`
14+
15+
## 1.0.0b5
16+
17+
- This was a broken release
518

619
## 1.0.0b4 (2020-04-07)
720

sdk/textanalytics/azure-ai-textanalytics/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Install the Azure Text Analytics client library for Python with [pip][pip]:
2323
pip install azure-ai-textanalytics --pre
2424
```
2525

26+
> Note: This version of the client library supports the v3.0 version of the Text Analytics service
27+
2628
### Authenticate the client
2729
#### Create a Cognitive Services or Text Analytics resource
2830
Text Analytics supports both [multi-service and single-service access][multi_and_single_service].
@@ -343,7 +345,7 @@ result = [doc for doc in response if not doc.is_error]
343345
for doc in result:
344346
print("Language detected: {}".format(doc.primary_language.name))
345347
print("ISO6391 name: {}".format(doc.primary_language.iso6391_name))
346-
print("Confidence score: {}\n".format(doc.primary_language.score))
348+
print("Confidence score: {}\n".format(doc.primary_language.confidence_score))
347349
```
348350

349351
The returned response is a heterogeneous list of result and error objects: list[[DetectLanguageResult][detect_language_result], [DocumentError][document_error]]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
RecognizeEntitiesResult,
1818
DetectLanguageResult,
1919
TextAnalyticsError,
20+
TextAnalyticsWarning,
2021
ExtractKeyPhrasesResult,
2122
RecognizeLinkedEntitiesResult,
2223
TextDocumentStatistics,
@@ -35,6 +36,7 @@
3536
'DetectLanguageResult',
3637
'CategorizedEntity',
3738
'TextAnalyticsError',
39+
'TextAnalyticsWarning',
3840
'ExtractKeyPhrasesResult',
3941
'RecognizeLinkedEntitiesResult',
4042
'AnalyzeSentimentResult',

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88

99
from ._text_analytics_client import TextAnalyticsClient
1010
__all__ = ['TextAnalyticsClient']
11+
12+
try:
13+
from ._patch import patch_sdk
14+
patch_sdk()
15+
except ImportError:
16+
pass

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_configuration.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any
9+
from typing import TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
1313

14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any
17+
18+
from azure.core.credentials import TokenCredential
19+
1420
VERSION = "unknown"
1521

1622
class TextAnalyticsClientConfiguration(Configuration):
@@ -20,7 +26,7 @@ class TextAnalyticsClientConfiguration(Configuration):
2026
attributes.
2127
2228
:param credential: Credential needed for the client to connect to Azure.
23-
:type credential: azure.core.credentials.TokenCredential
29+
:type credential: ~azure.core.credentials.TokenCredential
2430
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
2531
:type endpoint: str
2632
"""
@@ -41,6 +47,7 @@ def __init__(
4147
self.credential = credential
4248
self.endpoint = endpoint
4349
self.credential_scopes = ['https://cognitiveservices.azure.com/.default']
50+
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
4451
kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
4552
self._configure(**kwargs)
4653

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_text_analytics_client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any
9+
from typing import TYPE_CHECKING
1010

1111
from azure.core import PipelineClient
1212
from msrest import Deserializer, Serializer
1313

14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any
17+
1418
from ._configuration import TextAnalyticsClientConfiguration
1519
from .operations import TextAnalyticsClientOperationsMixin
1620
from . import models
@@ -20,9 +24,10 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin):
2024
"""The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview.
2125
2226
:param credential: Credential needed for the client to connect to Azure.
23-
:type credential: azure.core.credentials.TokenCredential
27+
:type credential: ~azure.core.credentials.TokenCredential
2428
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
2529
:type endpoint: str
30+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
2631
"""
2732

2833
def __init__(
@@ -32,7 +37,7 @@ def __init__(
3237
**kwargs # type: Any
3338
):
3439
# type: (...) -> None
35-
base_url = '{Endpoint}/text/analytics/v3.0-preview.1'
40+
base_url = '{Endpoint}/text/analytics/v3.0'
3641
self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs)
3742
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
3843

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_configuration_async.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
1313

14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from azure.core.credentials import TokenCredential
17+
1418
VERSION = "unknown"
1519

1620
class TextAnalyticsClientConfiguration(Configuration):
@@ -20,7 +24,7 @@ class TextAnalyticsClientConfiguration(Configuration):
2024
attributes.
2125
2226
:param credential: Credential needed for the client to connect to Azure.
23-
:type credential: azure.core.credentials.AsyncTokenCredential
27+
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
2428
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
2529
:type endpoint: str
2630
"""
@@ -40,6 +44,7 @@ def __init__(
4044
self.credential = credential
4145
self.endpoint = endpoint
4246
self.credential_scopes = ['https://cognitiveservices.azure.com/.default']
47+
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
4348
kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
4449
self._configure(**kwargs)
4550

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_text_analytics_client_async.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin):
2020
"""The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview.
2121
2222
:param credential: Credential needed for the client to connect to Azure.
23-
:type credential: azure.core.credentials.AsyncTokenCredential
23+
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
2424
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
2525
:type endpoint: str
26+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
2627
"""
2728

2829
def __init__(
@@ -31,7 +32,7 @@ def __init__(
3132
endpoint: str,
3233
**kwargs: Any
3334
) -> None:
34-
base_url = '{Endpoint}/text/analytics/v3.0-preview.1'
35+
base_url = '{Endpoint}/text/analytics/v3.0'
3536
self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs)
3637
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
3738

0 commit comments

Comments
 (0)