Skip to content

[text analytics] merging feature branch into master #11632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bacb27a
[text analytics]Regenerate with v3.0 (#11029)
iscai-msft Apr 24, 2020
91d7673
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft Apr 24, 2020
49d5c9b
[text analytics] have tests pass (as much as they can) in ci (#11055)
iscai-msft Apr 27, 2020
9972ed6
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft Apr 27, 2020
a9a9a63
[text analytics] score -> confidence_score in DetectedLanguage (#11076)
iscai-msft Apr 27, 2020
343f256
Merge branch 'feature/text_analytics_v3.0' of https://github.com/Azur…
iscai-msft Apr 27, 2020
136277c
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft Apr 27, 2020
decba26
[text analytics] Add text to sentence sentiment (#11054)
iscai-msft Apr 27, 2020
f436f1b
[text analytics] Fix test errors dl recognize entities (#11083)
iscai-msft Apr 27, 2020
9da3176
[text analytics] Add warnings (#11053)
iscai-msft Apr 27, 2020
1298442
removed grapheme_offset and grapheme_length, renamed grapheme_count t…
iscai-msft May 1, 2020
dd10299
[text analytics] Too many documents (#11155)
iscai-msft May 7, 2020
4448f01
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft May 15, 2020
f137d5f
Merge branch 'feature/text_analytics_v3.0' of https://github.com/Azur…
iscai-msft May 15, 2020
0127d74
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft May 18, 2020
6ac0ed0
fixed error code for bad model version error (#11497)
iscai-msft May 18, 2020
a38f5ef
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft May 21, 2020
93022a1
[text analytics] Remove dependence on ppe endpoint in tests, create T…
iscai-msft May 21, 2020
1e4fc73
updated changelog
iscai-msft May 26, 2020
8dcc2dd
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft May 26, 2020
60b6c2b
added section for b5
iscai-msft May 26, 2020
f9fa38f
specified SDK is now supporting v3.0
iscai-msft May 26, 2020
a37c903
removed dependency on canary region
iscai-msft May 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 14 additions & 1 deletion sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# Change Log azure-ai-textanalytics

## 1.0.0b5 (Unreleased)
## 1.0.0b6 (2020-05-27)
Copy link
Contributor Author

@iscai-msft iscai-msft May 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because I erroneously released 1.0.0b5 when trying to generate the private bits (very embarrassing), so b5 is burned for python


**New features**
- We now have a `warnings` property on each document-level response object returned from the endpoints. It is a list of `TextAnalyticsWarning`s.
- Added `text` property to `SentenceSentiment`

**Breaking changes**
- Now targets only the service's v3.0 API, instead of the v3.0-preview.1 API
- `score` attribute of `DetectedLanguage` has been renamed to `confidence_score`
- Removed `grapheme_offset` and `grapheme_length` from `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`
- `TextDocumentStatistics` attribute `grapheme_count` has been renamed to `character_count`

## 1.0.0b5

- This was a broken release

## 1.0.0b4 (2020-04-07)

Expand Down
4 changes: 3 additions & 1 deletion sdk/textanalytics/azure-ai-textanalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Install the Azure Text Analytics client library for Python with [pip][pip]:
pip install azure-ai-textanalytics --pre
```

> Note: This version of the client library supports the v3.0 version of the Text Analytics service

### Authenticate the client
#### Create a Cognitive Services or Text Analytics resource
Text Analytics supports both [multi-service and single-service access][multi_and_single_service].
Expand Down Expand Up @@ -343,7 +345,7 @@ result = [doc for doc in response if not doc.is_error]
for doc in result:
print("Language detected: {}".format(doc.primary_language.name))
print("ISO6391 name: {}".format(doc.primary_language.iso6391_name))
print("Confidence score: {}\n".format(doc.primary_language.score))
print("Confidence score: {}\n".format(doc.primary_language.confidence_score))
```

The returned response is a heterogeneous list of result and error objects: list[[DetectLanguageResult][detect_language_result], [DocumentError][document_error]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
RecognizeEntitiesResult,
DetectLanguageResult,
TextAnalyticsError,
TextAnalyticsWarning,
ExtractKeyPhrasesResult,
RecognizeLinkedEntitiesResult,
TextDocumentStatistics,
Expand All @@ -35,6 +36,7 @@
'DetectLanguageResult',
'CategorizedEntity',
'TextAnalyticsError',
'TextAnalyticsWarning',
'ExtractKeyPhrasesResult',
'RecognizeLinkedEntitiesResult',
'AnalyzeSentimentResult',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@

from ._text_analytics_client import TextAnalyticsClient
__all__ = ['TextAnalyticsClient']

try:
from ._patch import patch_sdk
patch_sdk()
except ImportError:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any
from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

VERSION = "unknown"

class TextAnalyticsClientConfiguration(Configuration):
Expand All @@ -20,7 +26,7 @@ class TextAnalyticsClientConfiguration(Configuration):
attributes.

:param credential: Credential needed for the client to connect to Azure.
:type credential: azure.core.credentials.TokenCredential
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
"""
Expand All @@ -41,6 +47,7 @@ def __init__(
self.credential = credential
self.endpoint = endpoint
self.credential_scopes = ['https://cognitiveservices.azure.com/.default']
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any
from typing import TYPE_CHECKING

from azure.core import PipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from ._configuration import TextAnalyticsClientConfiguration
from .operations import TextAnalyticsClientOperationsMixin
from . import models
Expand All @@ -20,9 +24,10 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin):
"""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.

:param credential: Credential needed for the client to connect to Azure.
:type credential: azure.core.credentials.TokenCredential
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

def __init__(
Expand All @@ -32,7 +37,7 @@ def __init__(
**kwargs # type: Any
):
# type: (...) -> None
base_url = '{Endpoint}/text/analytics/v3.0-preview.1'
base_url = '{Endpoint}/text/analytics/v3.0'
self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential

VERSION = "unknown"

class TextAnalyticsClientConfiguration(Configuration):
Expand All @@ -20,7 +24,7 @@ class TextAnalyticsClientConfiguration(Configuration):
attributes.

:param credential: Credential needed for the client to connect to Azure.
:type credential: azure.core.credentials.AsyncTokenCredential
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
"""
Expand All @@ -40,6 +44,7 @@ def __init__(
self.credential = credential
self.endpoint = endpoint
self.credential_scopes = ['https://cognitiveservices.azure.com/.default']
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin):
"""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.

:param credential: Credential needed for the client to connect to Azure.
:type credential: azure.core.credentials.AsyncTokenCredential
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

def __init__(
Expand All @@ -31,7 +32,7 @@ def __init__(
endpoint: str,
**kwargs: Any
) -> None:
base_url = '{Endpoint}/text/analytics/v3.0-preview.1'
base_url = '{Endpoint}/text/analytics/v3.0'
self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

Expand Down
Loading