Skip to content

Commit

Permalink
[text analytics] default to v3.1-preview.2, have it listed under enum…
Browse files Browse the repository at this point in the history
… V3_1_PREVIEW (#13708)
  • Loading branch information
iscai-msft committed Sep 10, 2020
1 parent bbcc72f commit a866f59
Show file tree
Hide file tree
Showing 519 changed files with 2,952 additions and 7,870 deletions.
11 changes: 5 additions & 6 deletions sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
## 5.1.0b1 (Unreleased)

**New features**
- We are now targeting the service's v3.1-preview.1 API as the default. If you would like to still use version v3.0 of the service,
- We are now targeting the service's v3.1-preview API as the default. If you would like to still use version v3.0 of the service,
pass in `v3.0` to the kwarg `api_version` when creating your TextAnalyticsClient
- We have added an API `recognize_pii_entities` which returns entities containing personal information for a batch of documents. Only available for API version v3.1-preview.1 and up.
- In API version v3.1-preview.2 and up, the redacted text of the document is returned on the top-level result object `RecognizePiiEntitiesResult` through property `redacted_text`.
- Added `offset` and `length` properties for `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`. These properties are only available for API versions v3.1-preview.1 and up.
- We have added an API `recognize_pii_entities` which returns entities containing personally identifiable information for a batch of documents. Only available for API version v3.1-preview and up.
- Added `offset` and `length` properties for `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`. These properties are only available for API versions v3.1-preview and up.
- `length` is the number of characters in the text of these models
- `offset` is the offset of the text from the start of the document
- We now have added support for opinion mining. To use this feature, you need to make sure you are using the service's
v3.1-preview.1 API. To get this support pass `show_opinion_mining` as True when calling the `analyze_sentiment` endpoint
- Add property `bing_entity_search_api_id` to the `LinkedEntity` class. This property is only available for v3.1-preview.2 and up, and it is to be
v3.1-preview API. To get this support pass `show_opinion_mining` as True when calling the `analyze_sentiment` endpoint
- Add property `bing_entity_search_api_id` to the `LinkedEntity` class. This property is only available for v3.1-preview and up, and it is to be
used in conjunction with the Bing Entity Search API to fetch additional relevant information about the returned entity.

## 5.0.0 (2020-07-27)
Expand Down
2 changes: 1 addition & 1 deletion sdk/textanalytics/azure-ai-textanalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ and [supported types][linked_entities_categories].

### Recognize PII entities
[recognize_pii_entities][recognize_pii_entities] recognizes and categorizes Personally Identifiable Information (PII) entities in its input text, such as
Social Security Numbers, bank account information, credit card numbers, and more. This endpoint is only available for v3.1-preview.1 and up.
Social Security Numbers, bank account information, credit card numbers, and more. This endpoint is only available for v3.1-preview and up.

```python
from azure.core.credentials import AzureKeyCredential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ class TextAnalyticsApiVersion(str, Enum):
"""Text Analytics API versions supported by this package"""

#: this is the default version
V3_1_PREVIEW_1 = "v3.1-preview.1"

# 3.1-preview.2 is not yet the default version since we don't have a
# reliable endpoint
V3_1_PREVIEW_2 = "v3.1-preview.2"
V3_1_PREVIEW = "v3.1-preview.2"
V3_0 = "v3.0"

def _authentication_policy(credential):
Expand All @@ -40,7 +36,7 @@ def __init__(self, endpoint, credential, **kwargs):
self._client = _TextAnalyticsClient(
endpoint=endpoint,
credential=credential,
api_version=kwargs.pop("api_version", TextAnalyticsApiVersion.V3_1_PREVIEW_1),
api_version=kwargs.pop("api_version", TextAnalyticsApiVersion.V3_1_PREVIEW),
sdk_moniker=USER_AGENT,
authentication_policy=_authentication_policy(credential),
custom_hook_policy=TextAnalyticsResponseHookPolicy(**kwargs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._text_analytics_client_async import TextAnalyticsClient
from ._text_analytics_client import TextAnalyticsClient
__all__ = ['TextAnalyticsClient']
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ async def entities_linking(
"""
api_version = self._get_api_version('entities_linking')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -90,11 +90,11 @@ async def entities_recognition_general(
"""
api_version = self._get_api_version('entities_recognition_general')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -142,9 +142,9 @@ async def entities_recognition_pii(
"""
api_version = self._get_api_version('entities_recognition_pii')
if api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -182,11 +182,11 @@ async def key_phrases(
"""
api_version = self._get_api_version('key_phrases')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -225,11 +225,11 @@ async def languages(
"""
api_version = self._get_api_version('languages')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -268,11 +268,11 @@ async def sentiment(
"""
api_version = self._get_api_version('sentiment')
if api_version == 'v3.0':
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_0.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_1.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
from ..v3_1_preview_2.aio.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration_async import TextAnalyticsClientConfiguration
from ._operations_mixin_async import TextAnalyticsClientOperationsMixin
from ._configuration import TextAnalyticsClientConfiguration
from ._operations_mixin import TextAnalyticsClientOperationsMixin
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._text_analytics_client_async import TextAnalyticsClient
from ._text_analytics_client import TextAnalyticsClient
__all__ = ['TextAnalyticsClient']
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration_async import TextAnalyticsClientConfiguration
from .operations_async import TextAnalyticsClientOperationsMixin
from ._configuration import TextAnalyticsClientConfiguration
from .operations import TextAnalyticsClientOperationsMixin
from .. import models


Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a866f59

Please sign in to comment.