Skip to content

Commit

Permalink
[text analytics] regenerate with v3.1-preview.2 (#13347)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft committed Aug 27, 2020
1 parent b83018d commit 0feed6e
Show file tree
Hide file tree
Showing 439 changed files with 7,659 additions and 2,991 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,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', []))
self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-ai-textanalytics/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union


class TextAnalyticsClientOperationsMixin(object):
Expand Down Expand Up @@ -54,6 +54,8 @@ def entities_linking(
from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from .v3_1_preview_1.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from .v3_1_preview_2.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -95,6 +97,8 @@ def entities_recognition_general(
from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from .v3_1_preview_1.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from .v3_1_preview_2.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -110,6 +114,7 @@ def entities_recognition_pii(
model_version=None, # type: Optional[str]
show_stats=None, # type: Optional[bool]
domain=None, # type: Optional[str]
string_index_type="TextElements_v8", # type: Optional[Union[str, "models.StringIndexType"]]
**kwargs # type: Any
):
"""Entities containing personal information.
Expand All @@ -121,31 +126,37 @@ def entities_recognition_pii(
list of enabled languages.
:param documents: The set of documents to process as part of this batch.
:type documents: list[~azure.ai.textanalytics.v3_1_preview_1.models.MultiLanguageInput]
:type documents: list[~azure.ai.textanalytics.v3_1_preview_2.models.MultiLanguageInput]
:param model_version: (Optional) This value indicates which model will be used for scoring. If
a model-version is not specified, the API should default to the latest, non-preview version.
:type model_version: str
:param show_stats: (Optional) if set to true, response will contain input and document level
:param show_stats: (Optional) if set to true, response will contain request and document level
statistics.
:type show_stats: bool
:param domain: (Optional) if set to 'PHI', response will contain only PHI entities.
:type domain: str
:param string_index_type: (Optional) Specifies the method used to interpret string offsets.
Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information
see https://aka.ms/text-analytics-offsets.
:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_2.models.StringIndexType
:keyword callable cls: A custom type or function that will be passed the direct response
:return: EntitiesResult, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v3_1_preview_1.models.EntitiesResult
:return: PiiEntitiesResult, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v3_1_preview_2.models.PiiEntitiesResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = self._get_api_version('entities_recognition_pii')
if api_version == 'v3.1-preview.1':
from .v3_1_preview_1.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from .v3_1_preview_2.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return mixin_instance.entities_recognition_pii(documents, model_version, show_stats, domain, **kwargs)
return mixin_instance.entities_recognition_pii(documents, model_version, show_stats, domain, string_index_type, **kwargs)

def key_phrases(
self,
Expand Down Expand Up @@ -178,6 +189,8 @@ def key_phrases(
from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from .v3_1_preview_1.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from .v3_1_preview_2.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -219,6 +232,8 @@ def languages(
from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from .v3_1_preview_1.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from .v3_1_preview_2.operations import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -260,6 +275,8 @@ def sentiment(
from .v3_0.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from .v3_1_preview_1.operations import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from .v3_1_preview_2.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 @@ -42,7 +42,6 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin, MultiApiClientMixi
missing in profile.
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = 'v3.0'
Expand All @@ -66,6 +65,8 @@ def __init__(
base_url = '{Endpoint}/text/analytics/v3.0'
elif api_version == 'v3.1-preview.1':
base_url = '{Endpoint}/text/analytics/v3.1-preview.1'
elif api_version == 'v3.1-preview.2':
base_url = '{Endpoint}/text/analytics/v3.1-preview.2'
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs)
Expand All @@ -85,13 +86,17 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* v3.0: :mod:`v3_0.models<azure.ai.textanalytics.v3_0.models>`
* v3.1-preview.1: :mod:`v3_1_preview_1.models<azure.ai.textanalytics.v3_1_preview_1.models>`
* v3.1-preview.2: :mod:`v3_1_preview_2.models<azure.ai.textanalytics.v3_1_preview_2.models>`
"""
if api_version == 'v3.0':
from .v3_0 import models
return models
elif api_version == 'v3.1-preview.1':
from .v3_1_preview_1 import models
return models
elif api_version == 'v3.1-preview.2':
from .v3_1_preview_2 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

def close(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,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', []))
self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-ai-textanalytics/{}'.format(VERSION))
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------
from msrest import Serializer, Deserializer
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings

from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
Expand Down Expand Up @@ -50,6 +50,8 @@ async def entities_linking(
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -91,6 +93,8 @@ async def entities_recognition_general(
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -106,8 +110,9 @@ async def entities_recognition_pii(
model_version: Optional[str] = None,
show_stats: Optional[bool] = None,
domain: Optional[str] = None,
string_index_type: Optional[Union[str, "models.StringIndexType"]] = "TextElements_v8",
**kwargs
) -> "models.EntitiesResult":
) -> "models.PiiEntitiesResult":
"""Entities containing personal information.
The API returns a list of entities with personal information (\"SSN\", \"Bank Account\" etc) in
Expand All @@ -117,31 +122,37 @@ async def entities_recognition_pii(
list of enabled languages.
:param documents: The set of documents to process as part of this batch.
:type documents: list[~azure.ai.textanalytics.v3_1_preview_1.models.MultiLanguageInput]
:type documents: list[~azure.ai.textanalytics.v3_1_preview_2.models.MultiLanguageInput]
:param model_version: (Optional) This value indicates which model will be used for scoring. If
a model-version is not specified, the API should default to the latest, non-preview version.
:type model_version: str
:param show_stats: (Optional) if set to true, response will contain input and document level
:param show_stats: (Optional) if set to true, response will contain request and document level
statistics.
:type show_stats: bool
:param domain: (Optional) if set to 'PHI', response will contain only PHI entities.
:type domain: str
:param string_index_type: (Optional) Specifies the method used to interpret string offsets.
Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information
see https://aka.ms/text-analytics-offsets.
:type string_index_type: str or ~azure.ai.textanalytics.v3_1_preview_2.models.StringIndexType
:keyword callable cls: A custom type or function that will be passed the direct response
:return: EntitiesResult, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v3_1_preview_1.models.EntitiesResult
:return: PiiEntitiesResult, or the result of cls(response)
:rtype: ~azure.ai.textanalytics.v3_1_preview_2.models.PiiEntitiesResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
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
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
mixin_instance._client = self._client
mixin_instance._config = self._config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
return await mixin_instance.entities_recognition_pii(documents, model_version, show_stats, domain, **kwargs)
return await mixin_instance.entities_recognition_pii(documents, model_version, show_stats, domain, string_index_type, **kwargs)

async def key_phrases(
self,
Expand Down Expand Up @@ -174,6 +185,8 @@ async def key_phrases(
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -215,6 +228,8 @@ async def languages(
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -256,6 +271,8 @@ async def sentiment(
from ..v3_0.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1.aio.operations_async import TextAnalyticsClientOperationsMixin as OperationClass
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2.aio.operations_async 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 @@ -42,7 +42,6 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin, MultiApiClientMixi
missing in profile.
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = 'v3.0'
Expand All @@ -66,6 +65,8 @@ def __init__(
base_url = '{Endpoint}/text/analytics/v3.0'
elif api_version == 'v3.1-preview.1':
base_url = '{Endpoint}/text/analytics/v3.1-preview.1'
elif api_version == 'v3.1-preview.2':
base_url = '{Endpoint}/text/analytics/v3.1-preview.2'
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs)
Expand All @@ -85,13 +86,17 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* v3.0: :mod:`v3_0.models<azure.ai.textanalytics.v3_0.models>`
* v3.1-preview.1: :mod:`v3_1_preview_1.models<azure.ai.textanalytics.v3_1_preview_1.models>`
* v3.1-preview.2: :mod:`v3_1_preview_2.models<azure.ai.textanalytics.v3_1_preview_2.models>`
"""
if api_version == 'v3.0':
from ..v3_0 import models
return models
elif api_version == 'v3.1-preview.1':
from ..v3_1_preview_1 import models
return models
elif api_version == 'v3.1-preview.2':
from ..v3_1_preview_2 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

async def close(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,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', []))
self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default'])
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 @@ -7,7 +7,8 @@
"description": "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.",
"base_url": null,
"custom_base_url": "\u0027{Endpoint}/text/analytics/v3.0\u0027",
"azure_arm": false
"azure_arm": false,
"has_lro_operations": false
},
"global_parameters": {
"sync_method": {
Expand Down Expand Up @@ -46,7 +47,8 @@
"credential": true,
"credential_scopes": ["https://cognitiveservices.azure.com/.default"],
"credential_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null
},
"operation_groups": {
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class TextAnalyticsClient(TextAnalyticsClientOperationsMixin):
: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 Down
Loading

0 comments on commit 0feed6e

Please sign in to comment.