diff --git a/azure-cognitiveservices-language-textanalytics/HISTORY.rst b/azure-cognitiveservices-language-textanalytics/HISTORY.rst index d521caf0f949..e729ac349f6c 100644 --- a/azure-cognitiveservices-language-textanalytics/HISTORY.rst +++ b/azure-cognitiveservices-language-textanalytics/HISTORY.rst @@ -3,6 +3,43 @@ Release History =============== +0.2.0 (2019-03-12) +++++++++++++++++++ + +**Features** + +- Client class can be used as a context manager to keep the underlying HTTP session open for performance +- New method "entities" +- Model KeyPhraseBatchResultItem has a new parameter statistics +- Model KeyPhraseBatchResult has a new parameter statistics +- Model LanguageBatchResult has a new parameter statistics +- Model LanguageBatchResultItem has a new parameter statistics +- Model SentimentBatchResult has a new parameter statistics + +**Breaking changes** + +- TextAnalyticsAPI main client has been renamed TextAnalyticsClient +- TextAnalyticsClient parameter is no longer a region but a complete endpoint + +**General Breaking changes** + +This version uses a next-generation code generator that *might* introduce breaking changes. + +- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments. + To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments. +- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered. + While this is not a breaking change, the distinctions are important, and are documented here: + https://docs.python.org/3/library/enum.html#others + At a glance: + + - "is" should not be used at all. + - "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered. + +**Bugfixes** + +- Compatibility of the sdist with wheel 0.31.0 + + 0.1.0 (2018-01-12) ++++++++++++++++++ diff --git a/azure-cognitiveservices-language-textanalytics/MANIFEST.in b/azure-cognitiveservices-language-textanalytics/MANIFEST.in index 7f728a95d094..8d9b981dde9c 100644 --- a/azure-cognitiveservices-language-textanalytics/MANIFEST.in +++ b/azure-cognitiveservices-language-textanalytics/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/cognitiveservices/__init__.py diff --git a/azure-cognitiveservices-language-textanalytics/README.rst b/azure-cognitiveservices-language-textanalytics/README.rst index f4eb8577fd9d..92be5e170da6 100644 --- a/azure-cognitiveservices-language-textanalytics/README.rst +++ b/azure-cognitiveservices-language-textanalytics/README.rst @@ -8,25 +8,6 @@ This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py index 23d58bb9b60a..9a75fc1a0e69 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .text_analytics_api import TextAnalyticsAPI +from .text_analytics_client import TextAnalyticsClient from .version import VERSION -__all__ = ['TextAnalyticsAPI'] +__all__ = ['TextAnalyticsClient'] __version__ = VERSION diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py index 1f87b1c998b0..be4003cc1ae8 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py @@ -9,38 +9,68 @@ # regenerated. # -------------------------------------------------------------------------- -from .multi_language_input import MultiLanguageInput -from .multi_language_batch_input import MultiLanguageBatchInput -from .key_phrase_batch_result_item import KeyPhraseBatchResultItem -from .error_record import ErrorRecord -from .key_phrase_batch_result import KeyPhraseBatchResult -from .internal_error import InternalError -from .error_response import ErrorResponse, ErrorResponseException -from .input import Input -from .batch_input import BatchInput -from .detected_language import DetectedLanguage -from .language_batch_result_item import LanguageBatchResultItem -from .language_batch_result import LanguageBatchResult -from .sentiment_batch_result_item import SentimentBatchResultItem -from .sentiment_batch_result import SentimentBatchResult -from .text_analytics_api_enums import ( - AzureRegions, -) +try: + from .multi_language_input_py3 import MultiLanguageInput + from .multi_language_batch_input_py3 import MultiLanguageBatchInput + from .match_record_py3 import MatchRecord + from .entity_record_py3 import EntityRecord + from .document_statistics_py3 import DocumentStatistics + from .entities_batch_result_item_py3 import EntitiesBatchResultItem + from .error_record_py3 import ErrorRecord + from .request_statistics_py3 import RequestStatistics + from .entities_batch_result_py3 import EntitiesBatchResult + from .internal_error_py3 import InternalError + from .error_response_py3 import ErrorResponse, ErrorResponseException + from .key_phrase_batch_result_item_py3 import KeyPhraseBatchResultItem + from .key_phrase_batch_result_py3 import KeyPhraseBatchResult + from .language_input_py3 import LanguageInput + from .language_batch_input_py3 import LanguageBatchInput + from .detected_language_py3 import DetectedLanguage + from .language_batch_result_item_py3 import LanguageBatchResultItem + from .language_batch_result_py3 import LanguageBatchResult + from .sentiment_batch_result_item_py3 import SentimentBatchResultItem + from .sentiment_batch_result_py3 import SentimentBatchResult +except (SyntaxError, ImportError): + from .multi_language_input import MultiLanguageInput + from .multi_language_batch_input import MultiLanguageBatchInput + from .match_record import MatchRecord + from .entity_record import EntityRecord + from .document_statistics import DocumentStatistics + from .entities_batch_result_item import EntitiesBatchResultItem + from .error_record import ErrorRecord + from .request_statistics import RequestStatistics + from .entities_batch_result import EntitiesBatchResult + from .internal_error import InternalError + from .error_response import ErrorResponse, ErrorResponseException + from .key_phrase_batch_result_item import KeyPhraseBatchResultItem + from .key_phrase_batch_result import KeyPhraseBatchResult + from .language_input import LanguageInput + from .language_batch_input import LanguageBatchInput + from .detected_language import DetectedLanguage + from .language_batch_result_item import LanguageBatchResultItem + from .language_batch_result import LanguageBatchResult + from .sentiment_batch_result_item import SentimentBatchResultItem + from .sentiment_batch_result import SentimentBatchResult __all__ = [ 'MultiLanguageInput', 'MultiLanguageBatchInput', - 'KeyPhraseBatchResultItem', + 'MatchRecord', + 'EntityRecord', + 'DocumentStatistics', + 'EntitiesBatchResultItem', 'ErrorRecord', - 'KeyPhraseBatchResult', + 'RequestStatistics', + 'EntitiesBatchResult', 'InternalError', 'ErrorResponse', 'ErrorResponseException', - 'Input', - 'BatchInput', + 'KeyPhraseBatchResultItem', + 'KeyPhraseBatchResult', + 'LanguageInput', + 'LanguageBatchInput', 'DetectedLanguage', 'LanguageBatchResultItem', 'LanguageBatchResult', 'SentimentBatchResultItem', 'SentimentBatchResult', - 'AzureRegions', ] diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/detected_language.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/detected_language.py index 08aa908b61ed..4741f83e264f 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/detected_language.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/detected_language.py @@ -31,8 +31,8 @@ class DetectedLanguage(Model): 'score': {'key': 'score', 'type': 'float'}, } - def __init__(self, name=None, iso6391_name=None, score=None): - super(DetectedLanguage, self).__init__() - self.name = name - self.iso6391_name = iso6391_name - self.score = score + def __init__(self, **kwargs): + super(DetectedLanguage, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.iso6391_name = kwargs.get('iso6391_name', None) + self.score = kwargs.get('score', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/detected_language_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/detected_language_py3.py new file mode 100644 index 000000000000..87824c274b58 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/detected_language_py3.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DetectedLanguage(Model): + """DetectedLanguage. + + :param name: Long name of a detected language (e.g. English, French). + :type name: str + :param iso6391_name: A two letter representation of the detected language + according to the ISO 639-1 standard (e.g. en, fr). + :type iso6391_name: str + :param score: A confidence score between 0 and 1. Scores close to 1 + indicate 100% certainty that the identified language is true. + :type score: float + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'iso6391_name': {'key': 'iso6391Name', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + } + + def __init__(self, *, name: str=None, iso6391_name: str=None, score: float=None, **kwargs) -> None: + super(DetectedLanguage, self).__init__(**kwargs) + self.name = name + self.iso6391_name = iso6391_name + self.score = score diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/document_statistics.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/document_statistics.py new file mode 100644 index 000000000000..d1eb5f21f89d --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/document_statistics.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DocumentStatistics(Model): + """DocumentStatistics. + + :param characters_count: Number of text elements recognized in the + document. + :type characters_count: int + :param transactions_count: Number of transactions for the document. + :type transactions_count: int + """ + + _attribute_map = { + 'characters_count': {'key': 'charactersCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(DocumentStatistics, self).__init__(**kwargs) + self.characters_count = kwargs.get('characters_count', None) + self.transactions_count = kwargs.get('transactions_count', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/document_statistics_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/document_statistics_py3.py new file mode 100644 index 000000000000..1b54590697d2 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/document_statistics_py3.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DocumentStatistics(Model): + """DocumentStatistics. + + :param characters_count: Number of text elements recognized in the + document. + :type characters_count: int + :param transactions_count: Number of transactions for the document. + :type transactions_count: int + """ + + _attribute_map = { + 'characters_count': {'key': 'charactersCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'int'}, + } + + def __init__(self, *, characters_count: int=None, transactions_count: int=None, **kwargs) -> None: + super(DocumentStatistics, self).__init__(**kwargs) + self.characters_count = characters_count + self.transactions_count = transactions_count diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result.py new file mode 100644 index 000000000000..b507c8eb712b --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EntitiesBatchResult(Model): + """EntitiesBatchResult. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar documents: Response by document + :vartype documents: + list[~azure.cognitiveservices.language.textanalytics.models.EntitiesBatchResultItem] + :ivar errors: Errors and Warnings by document + :vartype errors: + list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + """ + + _validation = { + 'documents': {'readonly': True}, + 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[EntitiesBatchResultItem]'}, + 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + } + + def __init__(self, **kwargs): + super(EntitiesBatchResult, self).__init__(**kwargs) + self.documents = None + self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_item.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_item.py new file mode 100644 index 000000000000..e79c98b04f33 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_item.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EntitiesBatchResultItem(Model): + """EntitiesBatchResultItem. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Unique, non-empty document identifier. + :type id: str + :ivar entities: Recognized entities in the document. + :vartype entities: + list[~azure.cognitiveservices.language.textanalytics.models.EntityRecord] + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics + """ + + _validation = { + 'entities': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[EntityRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, **kwargs): + super(EntitiesBatchResultItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.entities = None + self.statistics = kwargs.get('statistics', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_item_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_item_py3.py new file mode 100644 index 000000000000..57c68b4f7b23 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_item_py3.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EntitiesBatchResultItem(Model): + """EntitiesBatchResultItem. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Unique, non-empty document identifier. + :type id: str + :ivar entities: Recognized entities in the document. + :vartype entities: + list[~azure.cognitiveservices.language.textanalytics.models.EntityRecord] + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics + """ + + _validation = { + 'entities': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[EntityRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str=None, statistics=None, **kwargs) -> None: + super(EntitiesBatchResultItem, self).__init__(**kwargs) + self.id = id + self.entities = None + self.statistics = statistics diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_py3.py new file mode 100644 index 000000000000..2f739f07316e --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entities_batch_result_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EntitiesBatchResult(Model): + """EntitiesBatchResult. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar documents: Response by document + :vartype documents: + list[~azure.cognitiveservices.language.textanalytics.models.EntitiesBatchResultItem] + :ivar errors: Errors and Warnings by document + :vartype errors: + list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + """ + + _validation = { + 'documents': {'readonly': True}, + 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[EntitiesBatchResultItem]'}, + 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + } + + def __init__(self, **kwargs) -> None: + super(EntitiesBatchResult, self).__init__(**kwargs) + self.documents = None + self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entity_record.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entity_record.py new file mode 100644 index 000000000000..ba9796142272 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entity_record.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EntityRecord(Model): + """EntityRecord. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: Entity formal name. + :type name: str + :param matches: List of instances this entity appears in the text. + :type matches: + list[~azure.cognitiveservices.language.textanalytics.models.MatchRecord] + :param wikipedia_language: Wikipedia language for which the WikipediaId + and WikipediaUrl refers to. + :type wikipedia_language: str + :param wikipedia_id: Wikipedia unique identifier of the recognized entity. + :type wikipedia_id: str + :ivar wikipedia_url: URL for the entity's Wikipedia page. + :vartype wikipedia_url: str + :param bing_id: Bing unique identifier of the recognized entity. Use in + conjunction with the Bing Entity Search API to fetch additional relevant + information. + :type bing_id: str + :param type: Entity type from Named Entity Recognition model + :type type: str + :param sub_type: Entity sub type from Named Entity Recognition model + :type sub_type: str + """ + + _validation = { + 'wikipedia_url': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'matches': {'key': 'matches', 'type': '[MatchRecord]'}, + 'wikipedia_language': {'key': 'wikipediaLanguage', 'type': 'str'}, + 'wikipedia_id': {'key': 'wikipediaId', 'type': 'str'}, + 'wikipedia_url': {'key': 'wikipediaUrl', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sub_type': {'key': 'subType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EntityRecord, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.matches = kwargs.get('matches', None) + self.wikipedia_language = kwargs.get('wikipedia_language', None) + self.wikipedia_id = kwargs.get('wikipedia_id', None) + self.wikipedia_url = None + self.bing_id = kwargs.get('bing_id', None) + self.type = kwargs.get('type', None) + self.sub_type = kwargs.get('sub_type', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entity_record_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entity_record_py3.py new file mode 100644 index 000000000000..a857d52fa3cc --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/entity_record_py3.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EntityRecord(Model): + """EntityRecord. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: Entity formal name. + :type name: str + :param matches: List of instances this entity appears in the text. + :type matches: + list[~azure.cognitiveservices.language.textanalytics.models.MatchRecord] + :param wikipedia_language: Wikipedia language for which the WikipediaId + and WikipediaUrl refers to. + :type wikipedia_language: str + :param wikipedia_id: Wikipedia unique identifier of the recognized entity. + :type wikipedia_id: str + :ivar wikipedia_url: URL for the entity's Wikipedia page. + :vartype wikipedia_url: str + :param bing_id: Bing unique identifier of the recognized entity. Use in + conjunction with the Bing Entity Search API to fetch additional relevant + information. + :type bing_id: str + :param type: Entity type from Named Entity Recognition model + :type type: str + :param sub_type: Entity sub type from Named Entity Recognition model + :type sub_type: str + """ + + _validation = { + 'wikipedia_url': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'matches': {'key': 'matches', 'type': '[MatchRecord]'}, + 'wikipedia_language': {'key': 'wikipediaLanguage', 'type': 'str'}, + 'wikipedia_id': {'key': 'wikipediaId', 'type': 'str'}, + 'wikipedia_url': {'key': 'wikipediaUrl', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sub_type': {'key': 'subType', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, matches=None, wikipedia_language: str=None, wikipedia_id: str=None, bing_id: str=None, type: str=None, sub_type: str=None, **kwargs) -> None: + super(EntityRecord, self).__init__(**kwargs) + self.name = name + self.matches = matches + self.wikipedia_language = wikipedia_language + self.wikipedia_id = wikipedia_id + self.wikipedia_url = None + self.bing_id = bing_id + self.type = type + self.sub_type = sub_type diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_record.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_record.py index 81612548d011..22283996cab7 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_record.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_record.py @@ -26,7 +26,7 @@ class ErrorRecord(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, id=None, message=None): - super(ErrorRecord, self).__init__() - self.id = id - self.message = message + def __init__(self, **kwargs): + super(ErrorRecord, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.message = kwargs.get('message', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_record_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_record_py3.py new file mode 100644 index 000000000000..3ddcbca03f2c --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_record_py3.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ErrorRecord(Model): + """ErrorRecord. + + :param id: Input document unique identifier the error refers to. + :type id: str + :param message: Error message. + :type message: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, message: str=None, **kwargs) -> None: + super(ErrorRecord, self).__init__(**kwargs) + self.id = id + self.message = message diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_response.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_response.py index 22995c92068b..3a0197f190f3 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_response.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_response.py @@ -34,12 +34,12 @@ class ErrorResponse(Model): 'inner_error': {'key': 'innerError', 'type': 'InternalError'}, } - def __init__(self, code=None, message=None, target=None, inner_error=None): - super(ErrorResponse, self).__init__() - self.code = code - self.message = message - self.target = target - self.inner_error = inner_error + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.inner_error = kwargs.get('inner_error', None) class ErrorResponseException(HttpOperationError): diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_response_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_response_py3.py new file mode 100644 index 000000000000..92d272000249 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/error_response_py3.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorResponse(Model): + """ErrorResponse. + + :param code: + :type code: str + :param message: + :type message: str + :param target: + :type target: str + :param inner_error: + :type inner_error: + ~azure.cognitiveservices.language.textanalytics.models.InternalError + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InternalError'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, inner_error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.inner_error = inner_error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/internal_error.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/internal_error.py index 2e7e1ba6ea6f..1b40432d6d22 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/internal_error.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/internal_error.py @@ -30,8 +30,8 @@ class InternalError(Model): 'inner_error': {'key': 'innerError', 'type': 'InternalError'}, } - def __init__(self, code=None, message=None, inner_error=None): - super(InternalError, self).__init__() - self.code = code - self.message = message - self.inner_error = inner_error + def __init__(self, **kwargs): + super(InternalError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.inner_error = kwargs.get('inner_error', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/internal_error_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/internal_error_py3.py new file mode 100644 index 000000000000..db1299ef21de --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/internal_error_py3.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class InternalError(Model): + """InternalError. + + :param code: + :type code: str + :param message: + :type message: str + :param inner_error: + :type inner_error: + ~azure.cognitiveservices.language.textanalytics.models.InternalError + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InternalError'}, + } + + def __init__(self, *, code: str=None, message: str=None, inner_error=None, **kwargs) -> None: + super(InternalError, self).__init__(**kwargs) + self.code = code + self.message = message + self.inner_error = inner_error diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result.py index 03aa865b11bb..c266bdc98a88 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result.py @@ -18,25 +18,32 @@ class KeyPhraseBatchResult(Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar documents: + :ivar documents: Response by document :vartype documents: list[~azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResultItem] - :ivar errors: + :ivar errors: Errors and Warnings by document :vartype errors: list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: =(Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics """ _validation = { 'documents': {'readonly': True}, 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, } _attribute_map = { 'documents': {'key': 'documents', 'type': '[KeyPhraseBatchResultItem]'}, 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, } - def __init__(self): - super(KeyPhraseBatchResult, self).__init__() + def __init__(self, **kwargs): + super(KeyPhraseBatchResult, self).__init__(**kwargs) self.documents = None self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_item.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_item.py index f3ba063757ed..622b6a4e9968 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_item.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_item.py @@ -18,25 +18,30 @@ class KeyPhraseBatchResultItem(Model): Variables are only populated by the server, and will be ignored when sending a request. + :param id: Unique, non-empty document identifier. + :type id: str :ivar key_phrases: A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. :vartype key_phrases: list[str] - :ivar id: Unique document identifier. - :vartype id: str + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics """ _validation = { 'key_phrases': {'readonly': True}, - 'id': {'readonly': True}, } _attribute_map = { - 'key_phrases': {'key': 'keyPhrases', 'type': '[str]'}, 'id': {'key': 'id', 'type': 'str'}, + 'key_phrases': {'key': 'keyPhrases', 'type': '[str]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, } - def __init__(self): - super(KeyPhraseBatchResultItem, self).__init__() + def __init__(self, **kwargs): + super(KeyPhraseBatchResultItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) self.key_phrases = None - self.id = None + self.statistics = kwargs.get('statistics', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_item_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_item_py3.py new file mode 100644 index 000000000000..0571d6547394 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_item_py3.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class KeyPhraseBatchResultItem(Model): + """KeyPhraseBatchResultItem. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Unique, non-empty document identifier. + :type id: str + :ivar key_phrases: A list of representative words or phrases. The number + of key phrases returned is proportional to the number of words in the + input document. + :vartype key_phrases: list[str] + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics + """ + + _validation = { + 'key_phrases': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'key_phrases': {'key': 'keyPhrases', 'type': '[str]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str=None, statistics=None, **kwargs) -> None: + super(KeyPhraseBatchResultItem, self).__init__(**kwargs) + self.id = id + self.key_phrases = None + self.statistics = statistics diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_py3.py new file mode 100644 index 000000000000..c8f5219dc6a3 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/key_phrase_batch_result_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class KeyPhraseBatchResult(Model): + """KeyPhraseBatchResult. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar documents: Response by document + :vartype documents: + list[~azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResultItem] + :ivar errors: Errors and Warnings by document + :vartype errors: + list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: =(Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + """ + + _validation = { + 'documents': {'readonly': True}, + 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[KeyPhraseBatchResultItem]'}, + 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + } + + def __init__(self, **kwargs) -> None: + super(KeyPhraseBatchResult, self).__init__(**kwargs) + self.documents = None + self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_input.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_input.py new file mode 100644 index 000000000000..d9471a2aa72a --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_input.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class LanguageBatchInput(Model): + """LanguageBatchInput. + + :param documents: + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.LanguageInput] + """ + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[LanguageInput]'}, + } + + def __init__(self, **kwargs): + super(LanguageBatchInput, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/batch_input.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_input_py3.py similarity index 72% rename from azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/batch_input.py rename to azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_input_py3.py index d2f205ab8211..6e6a757b96ae 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/batch_input.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_input_py3.py @@ -12,18 +12,18 @@ from msrest.serialization import Model -class BatchInput(Model): - """BatchInput. +class LanguageBatchInput(Model): + """LanguageBatchInput. :param documents: :type documents: - list[~azure.cognitiveservices.language.textanalytics.models.Input] + list[~azure.cognitiveservices.language.textanalytics.models.LanguageInput] """ _attribute_map = { - 'documents': {'key': 'documents', 'type': '[Input]'}, + 'documents': {'key': 'documents', 'type': '[LanguageInput]'}, } - def __init__(self, documents=None): - super(BatchInput, self).__init__() + def __init__(self, *, documents=None, **kwargs) -> None: + super(LanguageBatchInput, self).__init__(**kwargs) self.documents = documents diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result.py index 6a790c5cee6c..23204992ed61 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result.py @@ -18,25 +18,32 @@ class LanguageBatchResult(Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar documents: + :ivar documents: Response by document :vartype documents: list[~azure.cognitiveservices.language.textanalytics.models.LanguageBatchResultItem] - :ivar errors: + :ivar errors: Errors and Warnings by document :vartype errors: list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics """ _validation = { 'documents': {'readonly': True}, 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, } _attribute_map = { 'documents': {'key': 'documents', 'type': '[LanguageBatchResultItem]'}, 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, } - def __init__(self): - super(LanguageBatchResult, self).__init__() + def __init__(self, **kwargs): + super(LanguageBatchResult, self).__init__(**kwargs) self.documents = None self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_item.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_item.py index 550b3c0ca74e..ef5a17f0132d 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_item.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_item.py @@ -15,27 +15,25 @@ class LanguageBatchResultItem(Model): """LanguageBatchResultItem. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Unique document identifier. - :vartype id: str - :ivar detected_languages: A list of extracted languages. - :vartype detected_languages: + :param id: Unique, non-empty document identifier. + :type id: str + :param detected_languages: A list of extracted languages. + :type detected_languages: list[~azure.cognitiveservices.language.textanalytics.models.DetectedLanguage] + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics """ - _validation = { - 'id': {'readonly': True}, - 'detected_languages': {'readonly': True}, - } - _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'detected_languages': {'key': 'detectedLanguages', 'type': '[DetectedLanguage]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, } - def __init__(self): - super(LanguageBatchResultItem, self).__init__() - self.id = None - self.detected_languages = None + def __init__(self, **kwargs): + super(LanguageBatchResultItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.detected_languages = kwargs.get('detected_languages', None) + self.statistics = kwargs.get('statistics', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_item_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_item_py3.py new file mode 100644 index 000000000000..3d3c499aeea1 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_item_py3.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class LanguageBatchResultItem(Model): + """LanguageBatchResultItem. + + :param id: Unique, non-empty document identifier. + :type id: str + :param detected_languages: A list of extracted languages. + :type detected_languages: + list[~azure.cognitiveservices.language.textanalytics.models.DetectedLanguage] + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'detected_languages': {'key': 'detectedLanguages', 'type': '[DetectedLanguage]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str=None, detected_languages=None, statistics=None, **kwargs) -> None: + super(LanguageBatchResultItem, self).__init__(**kwargs) + self.id = id + self.detected_languages = detected_languages + self.statistics = statistics diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_py3.py new file mode 100644 index 000000000000..7abe7d1b7bbd --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_batch_result_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class LanguageBatchResult(Model): + """LanguageBatchResult. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar documents: Response by document + :vartype documents: + list[~azure.cognitiveservices.language.textanalytics.models.LanguageBatchResultItem] + :ivar errors: Errors and Warnings by document + :vartype errors: + list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + """ + + _validation = { + 'documents': {'readonly': True}, + 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[LanguageBatchResultItem]'}, + 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + } + + def __init__(self, **kwargs) -> None: + super(LanguageBatchResult, self).__init__(**kwargs) + self.documents = None + self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_input.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_input.py new file mode 100644 index 000000000000..d79347938d74 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_input.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class LanguageInput(Model): + """LanguageInput. + + :param country_hint: + :type country_hint: str + :param id: Unique, non-empty document identifier. + :type id: str + :param text: + :type text: str + """ + + _attribute_map = { + 'country_hint': {'key': 'countryHint', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LanguageInput, self).__init__(**kwargs) + self.country_hint = kwargs.get('country_hint', None) + self.id = kwargs.get('id', None) + self.text = kwargs.get('text', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/input.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_input_py3.py similarity index 69% rename from azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/input.py rename to azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_input_py3.py index 95a6ae5e185a..2cc72da091b2 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/input.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/language_input_py3.py @@ -12,9 +12,11 @@ from msrest.serialization import Model -class Input(Model): - """Input. +class LanguageInput(Model): + """LanguageInput. + :param country_hint: + :type country_hint: str :param id: Unique, non-empty document identifier. :type id: str :param text: @@ -22,11 +24,13 @@ class Input(Model): """ _attribute_map = { + 'country_hint': {'key': 'countryHint', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'text': {'key': 'text', 'type': 'str'}, } - def __init__(self, id=None, text=None): - super(Input, self).__init__() + def __init__(self, *, country_hint: str=None, id: str=None, text: str=None, **kwargs) -> None: + super(LanguageInput, self).__init__(**kwargs) + self.country_hint = country_hint self.id = id self.text = text diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/match_record.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/match_record.py new file mode 100644 index 000000000000..8ca1d6e5d7f6 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/match_record.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MatchRecord(Model): + """MatchRecord. + + :param wikipedia_score: (optional) If a well-known item with Wikipedia + link is recognized, a decimal number denoting the confidence level of the + Wikipedia info will be returned. + :type wikipedia_score: float + :param entity_type_score: (optional) If an entity type is recognized, a + decimal number denoting the confidence level of the entity type will be + returned. + :type entity_type_score: float + :param text: Entity text as appears in the request. + :type text: str + :param offset: Start position (in Unicode characters) for the entity match + text. + :type offset: int + :param length: Length (in Unicode characters) for the entity match text. + :type length: int + """ + + _attribute_map = { + 'wikipedia_score': {'key': 'wikipediaScore', 'type': 'float'}, + 'entity_type_score': {'key': 'entityTypeScore', 'type': 'float'}, + 'text': {'key': 'text', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(MatchRecord, self).__init__(**kwargs) + self.wikipedia_score = kwargs.get('wikipedia_score', None) + self.entity_type_score = kwargs.get('entity_type_score', None) + self.text = kwargs.get('text', None) + self.offset = kwargs.get('offset', None) + self.length = kwargs.get('length', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/match_record_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/match_record_py3.py new file mode 100644 index 000000000000..49995a79c23a --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/match_record_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MatchRecord(Model): + """MatchRecord. + + :param wikipedia_score: (optional) If a well-known item with Wikipedia + link is recognized, a decimal number denoting the confidence level of the + Wikipedia info will be returned. + :type wikipedia_score: float + :param entity_type_score: (optional) If an entity type is recognized, a + decimal number denoting the confidence level of the entity type will be + returned. + :type entity_type_score: float + :param text: Entity text as appears in the request. + :type text: str + :param offset: Start position (in Unicode characters) for the entity match + text. + :type offset: int + :param length: Length (in Unicode characters) for the entity match text. + :type length: int + """ + + _attribute_map = { + 'wikipedia_score': {'key': 'wikipediaScore', 'type': 'float'}, + 'entity_type_score': {'key': 'entityTypeScore', 'type': 'float'}, + 'text': {'key': 'text', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + } + + def __init__(self, *, wikipedia_score: float=None, entity_type_score: float=None, text: str=None, offset: int=None, length: int=None, **kwargs) -> None: + super(MatchRecord, self).__init__(**kwargs) + self.wikipedia_score = wikipedia_score + self.entity_type_score = entity_type_score + self.text = text + self.offset = offset + self.length = length diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_batch_input.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_batch_input.py index 3630cf2309d1..8c9c5d313a61 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_batch_input.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_batch_input.py @@ -24,6 +24,6 @@ class MultiLanguageBatchInput(Model): 'documents': {'key': 'documents', 'type': '[MultiLanguageInput]'}, } - def __init__(self, documents=None): - super(MultiLanguageBatchInput, self).__init__() - self.documents = documents + def __init__(self, **kwargs): + super(MultiLanguageBatchInput, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_batch_input_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_batch_input_py3.py new file mode 100644 index 000000000000..cbacf2d992f2 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_batch_input_py3.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MultiLanguageBatchInput(Model): + """MultiLanguageBatchInput. + + :param documents: + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + """ + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[MultiLanguageInput]'}, + } + + def __init__(self, *, documents=None, **kwargs) -> None: + super(MultiLanguageBatchInput, self).__init__(**kwargs) + self.documents = documents diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_input.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_input.py index 5341de6f4b83..da37a13ce080 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_input.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_input.py @@ -30,8 +30,8 @@ class MultiLanguageInput(Model): 'text': {'key': 'text', 'type': 'str'}, } - def __init__(self, language=None, id=None, text=None): - super(MultiLanguageInput, self).__init__() - self.language = language - self.id = id - self.text = text + def __init__(self, **kwargs): + super(MultiLanguageInput, self).__init__(**kwargs) + self.language = kwargs.get('language', None) + self.id = kwargs.get('id', None) + self.text = kwargs.get('text', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_input_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_input_py3.py new file mode 100644 index 000000000000..bd81650513d5 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/multi_language_input_py3.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MultiLanguageInput(Model): + """MultiLanguageInput. + + :param language: This is the 2 letter ISO 639-1 representation of a + language. For example, use "en" for English; "es" for Spanish etc., + :type language: str + :param id: Unique, non-empty document identifier. + :type id: str + :param text: + :type text: str + """ + + _attribute_map = { + 'language': {'key': 'language', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + def __init__(self, *, language: str=None, id: str=None, text: str=None, **kwargs) -> None: + super(MultiLanguageInput, self).__init__(**kwargs) + self.language = language + self.id = id + self.text = text diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/request_statistics.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/request_statistics.py new file mode 100644 index 000000000000..b8cc26575238 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/request_statistics.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RequestStatistics(Model): + """RequestStatistics. + + :param documents_count: Number of documents submitted in the request. + :type documents_count: int + :param valid_documents_count: Number of valid documents. This excludes + empty, over-size limit or non-supported languages documents. + :type valid_documents_count: int + :param erroneous_documents_count: Number of invalid documents. This + includes empty, over-size limit or non-supported languages documents. + :type erroneous_documents_count: int + :param transactions_count: Number of transactions for the request. + :type transactions_count: long + """ + + _attribute_map = { + 'documents_count': {'key': 'documentsCount', 'type': 'int'}, + 'valid_documents_count': {'key': 'validDocumentsCount', 'type': 'int'}, + 'erroneous_documents_count': {'key': 'erroneousDocumentsCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(RequestStatistics, self).__init__(**kwargs) + self.documents_count = kwargs.get('documents_count', None) + self.valid_documents_count = kwargs.get('valid_documents_count', None) + self.erroneous_documents_count = kwargs.get('erroneous_documents_count', None) + self.transactions_count = kwargs.get('transactions_count', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/request_statistics_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/request_statistics_py3.py new file mode 100644 index 000000000000..c93b32bba4c9 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/request_statistics_py3.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RequestStatistics(Model): + """RequestStatistics. + + :param documents_count: Number of documents submitted in the request. + :type documents_count: int + :param valid_documents_count: Number of valid documents. This excludes + empty, over-size limit or non-supported languages documents. + :type valid_documents_count: int + :param erroneous_documents_count: Number of invalid documents. This + includes empty, over-size limit or non-supported languages documents. + :type erroneous_documents_count: int + :param transactions_count: Number of transactions for the request. + :type transactions_count: long + """ + + _attribute_map = { + 'documents_count': {'key': 'documentsCount', 'type': 'int'}, + 'valid_documents_count': {'key': 'validDocumentsCount', 'type': 'int'}, + 'erroneous_documents_count': {'key': 'erroneousDocumentsCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'long'}, + } + + def __init__(self, *, documents_count: int=None, valid_documents_count: int=None, erroneous_documents_count: int=None, transactions_count: int=None, **kwargs) -> None: + super(RequestStatistics, self).__init__(**kwargs) + self.documents_count = documents_count + self.valid_documents_count = valid_documents_count + self.erroneous_documents_count = erroneous_documents_count + self.transactions_count = transactions_count diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result.py index 5758c55ab216..7fb12b8178b2 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result.py @@ -18,25 +18,32 @@ class SentimentBatchResult(Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar documents: + :ivar documents: Response by document :vartype documents: list[~azure.cognitiveservices.language.textanalytics.models.SentimentBatchResultItem] - :ivar errors: + :ivar errors: Errors and Warnings by document :vartype errors: list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics """ _validation = { 'documents': {'readonly': True}, 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, } _attribute_map = { 'documents': {'key': 'documents', 'type': '[SentimentBatchResultItem]'}, 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, } - def __init__(self): - super(SentimentBatchResult, self).__init__() + def __init__(self, **kwargs): + super(SentimentBatchResult, self).__init__(**kwargs) self.documents = None self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_item.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_item.py index d7d0ece09c0a..731682c63328 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_item.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_item.py @@ -15,29 +15,27 @@ class SentimentBatchResultItem(Model): """SentimentBatchResultItem. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar score: A decimal number between 0 and 1 denoting the sentiment of + :param id: Unique, non-empty document identifier. + :type id: str + :param score: A decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 usually refers to a positive document while a score below 0.3 normally has a negative connotation. Mid values refer to neutral text. - :vartype score: float - :ivar id: Unique document identifier. - :vartype id: str + :type score: float + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics """ - _validation = { - 'score': {'readonly': True}, - 'id': {'readonly': True}, - } - _attribute_map = { - 'score': {'key': 'score', 'type': 'float'}, 'id': {'key': 'id', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, } - def __init__(self): - super(SentimentBatchResultItem, self).__init__() - self.score = None - self.id = None + def __init__(self, **kwargs): + super(SentimentBatchResultItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.score = kwargs.get('score', None) + self.statistics = kwargs.get('statistics', None) diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_item_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_item_py3.py new file mode 100644 index 000000000000..c8acccf078cf --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_item_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SentimentBatchResultItem(Model): + """SentimentBatchResultItem. + + :param id: Unique, non-empty document identifier. + :type id: str + :param score: A decimal number between 0 and 1 denoting the sentiment of + the document. A score above 0.7 usually refers to a positive document + while a score below 0.3 normally has a negative connotation. Mid values + refer to neutral text. + :type score: float + :param statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the document payload. + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str=None, score: float=None, statistics=None, **kwargs) -> None: + super(SentimentBatchResultItem, self).__init__(**kwargs) + self.id = id + self.score = score + self.statistics = statistics diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_py3.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_py3.py new file mode 100644 index 000000000000..33acf655a979 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/sentiment_batch_result_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SentimentBatchResult(Model): + """SentimentBatchResult. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar documents: Response by document + :vartype documents: + list[~azure.cognitiveservices.language.textanalytics.models.SentimentBatchResultItem] + :ivar errors: Errors and Warnings by document + :vartype errors: + list[~azure.cognitiveservices.language.textanalytics.models.ErrorRecord] + :ivar statistics: (Optional) if showStats=true was specified in the + request this field will contain information about the request payload. + :vartype statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + """ + + _validation = { + 'documents': {'readonly': True}, + 'errors': {'readonly': True}, + 'statistics': {'readonly': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[SentimentBatchResultItem]'}, + 'errors': {'key': 'errors', 'type': '[ErrorRecord]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + } + + def __init__(self, **kwargs) -> None: + super(SentimentBatchResult, self).__init__(**kwargs) + self.documents = None + self.errors = None + self.statistics = None diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/text_analytics_api_enums.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/text_analytics_api_enums.py deleted file mode 100644 index aa4ac59013d4..000000000000 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/text_analytics_api_enums.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum - - -class AzureRegions(Enum): - - westus = "westus" - westeurope = "westeurope" - southeastasia = "southeastasia" - eastus2 = "eastus2" - westcentralus = "westcentralus" - westus2 = "westus2" - eastus = "eastus" - southcentralus = "southcentralus" - northeurope = "northeurope" - eastasia = "eastasia" - australiaeast = "australiaeast" - brazilsouth = "brazilsouth" diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/text_analytics_api.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/text_analytics_api.py deleted file mode 100644 index 347bbcaa5f44..000000000000 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/text_analytics_api.py +++ /dev/null @@ -1,278 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.service_client import ServiceClient -from msrest import Configuration, Serializer, Deserializer -from .version import VERSION -from msrest.pipeline import ClientRawResponse -from . import models - - -class TextAnalyticsAPIConfiguration(Configuration): - """Configuration for TextAnalyticsAPI - Note that all parameters used to create this instance are saved as instance - attributes. - - :param azure_region: Supported Azure regions for Cognitive Services - endpoints. Possible values include: 'westus', 'westeurope', - 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', - 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', - 'brazilsouth' - :type azure_region: str or - ~azure.cognitiveservices.language.textanalytics.models.AzureRegions - :param credentials: Subscription credentials which uniquely identify - client subscription. - :type credentials: None - """ - - def __init__( - self, azure_region, credentials): - - if azure_region is None: - raise ValueError("Parameter 'azure_region' must not be None.") - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - base_url = 'https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics' - - super(TextAnalyticsAPIConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-cognitiveservices-language-textanalytics/{}'.format(VERSION)) - - self.azure_region = azure_region - self.credentials = credentials - - -class TextAnalyticsAPI(object): - """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 - - :ivar config: Configuration for client. - :vartype config: TextAnalyticsAPIConfiguration - - :param azure_region: Supported Azure regions for Cognitive Services - endpoints. Possible values include: 'westus', 'westeurope', - 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', - 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', - 'brazilsouth' - :type azure_region: str or - ~azure.cognitiveservices.language.textanalytics.models.AzureRegions - :param credentials: Subscription credentials which uniquely identify - client subscription. - :type credentials: None - """ - - def __init__( - self, azure_region, credentials): - - self.config = TextAnalyticsAPIConfiguration(azure_region, credentials) - self._client = ServiceClient(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = 'v2.0' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - - def key_phrases( - self, documents=None, custom_headers=None, raw=False, **operation_config): - """The API returns a list of strings denoting the key talking points in - the input text. - - We employ techniques from Microsoft Office's sophisticated Natural - Language Processing toolkit. See the Text - Analytics Documentation for details about the languages that are - supported by key phrase extraction. - - :param documents: - :type documents: - list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: KeyPhraseBatchResult or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResult - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - input = models.MultiLanguageBatchInput(documents=documents) - - # Construct URL - url = '/v2.0/keyPhrases' - path_format_arguments = { - 'AzureRegion': self._serialize.url("self.config.azure_region", self.config.azure_region, 'AzureRegions', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._serialize.body(input, 'MultiLanguageBatchInput') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('KeyPhraseBatchResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def detect_language( - self, documents=None, custom_headers=None, raw=False, **operation_config): - """The API returns the detected language and a numeric score between 0 and - 1. - - Scores close to 1 indicate 100% certainty that the identified language - is true. A total of 120 languages are supported. - - :param documents: - :type documents: - list[~azure.cognitiveservices.language.textanalytics.models.Input] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: LanguageBatchResult or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.textanalytics.models.LanguageBatchResult - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - input = models.BatchInput(documents=documents) - - # Construct URL - url = '/v2.0/languages' - path_format_arguments = { - 'AzureRegion': self._serialize.url("self.config.azure_region", self.config.azure_region, 'AzureRegions', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._serialize.body(input, 'BatchInput') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LanguageBatchResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def sentiment( - self, documents=None, custom_headers=None, raw=False, **operation_config): - """The API returns a numeric score between 0 and 1. - - Scores close to 1 indicate positive sentiment, while scores close to 0 - indicate negative sentiment. Sentiment score is generated using - classification techniques. The input features to the classifier include - n-grams, features generated from part-of-speech tags, and word - embeddings. See the Text - Analytics Documentation for details about the languages that are - supported by sentiment analysis. - - :param documents: - :type documents: - list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SentimentBatchResult or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.textanalytics.models.SentimentBatchResult - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - input = models.MultiLanguageBatchInput(documents=documents) - - # Construct URL - url = '/v2.0/sentiment' - path_format_arguments = { - 'AzureRegion': self._serialize.url("self.config.azure_region", self.config.azure_region, 'AzureRegions', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._serialize.body(input, 'MultiLanguageBatchInput') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SentimentBatchResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/text_analytics_client.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/text_analytics_client.py new file mode 100644 index 000000000000..76dacf5ef417 --- /dev/null +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/text_analytics_client.py @@ -0,0 +1,377 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Configuration, Serializer, Deserializer +from .version import VERSION +from msrest.pipeline import ClientRawResponse +from msrest.exceptions import HttpOperationError +from . import models + + +class TextAnalyticsClientConfiguration(Configuration): + """Configuration for TextAnalyticsClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + base_url = '{Endpoint}/text/analytics/v2.1' + + super(TextAnalyticsClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-cognitiveservices-language-textanalytics/{}'.format(VERSION)) + + self.endpoint = endpoint + self.credentials = credentials + + +class TextAnalyticsClient(SDKClient): + """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 + + :ivar config: Configuration for client. + :vartype config: TextAnalyticsClientConfiguration + + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + self.config = TextAnalyticsClientConfiguration(endpoint, credentials) + super(TextAnalyticsClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = 'v2.1' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + + def detect_language( + self, show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config): + """The API returns the detected language and a numeric score between 0 and + 1. + + Scores close to 1 indicate 100% certainty that the identified language + is true. A total of 120 languages are supported. + + :param show_stats: (optional) if set to true, response will contain + input and document level statistics. + :type show_stats: bool + :param documents: + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.LanguageInput] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LanguageBatchResult or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.textanalytics.models.LanguageBatchResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + language_batch_input = None + if documents is not None: + language_batch_input = models.LanguageBatchInput(documents=documents) + + # Construct URL + url = self.detect_language.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + if language_batch_input is not None: + body_content = self._serialize.body(language_batch_input, 'LanguageBatchInput') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LanguageBatchResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + detect_language.metadata = {'url': '/languages'} + + def entities( + self, show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config): + """The API returns a list of recognized entities in a given document. + + To get even more information on each recognized entity we recommend + using the Bing Entity Search API by querying for the recognized + entities names. See the Supported + languages in Text Analytics API for the list of enabled languages. + + :param show_stats: (optional) if set to true, response will contain + input and document level statistics. + :type show_stats: bool + :param documents: + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EntitiesBatchResult or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.textanalytics.models.EntitiesBatchResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + multi_language_batch_input = None + if documents is not None: + multi_language_batch_input = models.MultiLanguageBatchInput(documents=documents) + + # Construct URL + url = self.entities.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + if multi_language_batch_input is not None: + body_content = self._serialize.body(multi_language_batch_input, 'MultiLanguageBatchInput') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('EntitiesBatchResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + entities.metadata = {'url': '/entities'} + + def key_phrases( + self, show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config): + """The API returns a list of strings denoting the key talking points in + the input text. + + See the Text + Analytics Documentation for details about the languages that are + supported by key phrase extraction. + + :param show_stats: (optional) if set to true, response will contain + input and document level statistics. + :type show_stats: bool + :param documents: + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: KeyPhraseBatchResult or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + multi_language_batch_input = None + if documents is not None: + multi_language_batch_input = models.MultiLanguageBatchInput(documents=documents) + + # Construct URL + url = self.key_phrases.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + if multi_language_batch_input is not None: + body_content = self._serialize.body(multi_language_batch_input, 'MultiLanguageBatchInput') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('KeyPhraseBatchResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + key_phrases.metadata = {'url': '/keyPhrases'} + + def sentiment( + self, show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config): + """The API returns a numeric score between 0 and 1. + + Scores close to 1 indicate positive sentiment, while scores close to 0 + indicate negative sentiment. A score of 0.5 indicates the lack of + sentiment (e.g. a factoid statement). See the Text + Analytics Documentation for details about the languages that are + supported by sentiment analysis. + + :param show_stats: (optional) if set to true, response will contain + input and document level statistics. + :type show_stats: bool + :param documents: + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: object or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + multi_language_batch_input = None + if documents is not None: + multi_language_batch_input = models.MultiLanguageBatchInput(documents=documents) + + # Construct URL + url = self.sentiment.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + if multi_language_batch_input is not None: + body_content = self._serialize.body(multi_language_batch_input, 'MultiLanguageBatchInput') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SentimentBatchResult', response) + if response.status_code == 500: + deserialized = self._deserialize('ErrorResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + sentiment.metadata = {'url': '/sentiment'} diff --git a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/version.py b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/version.py index e0ec669828cb..c995f7836cef 100644 --- a/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/version.py +++ b/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/version.py @@ -9,5 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" - +VERSION = "0.2.0" diff --git a/azure-cognitiveservices-language-textanalytics/build.json b/azure-cognitiveservices-language-textanalytics/build.json deleted file mode 100644 index f37b43d98ccf..000000000000 --- a/azure-cognitiveservices-language-textanalytics/build.json +++ /dev/null @@ -1,420 +0,0 @@ -{ - "autorest": [ - { - "resolvedInfo": null, - "packageMetadata": { - "name": "@microsoft.azure/autorest-core", - "version": "2.0.4228", - "engines": { - "node": ">=7.10.0" - }, - "dependencies": {}, - "optionalDependencies": {}, - "devDependencies": { - "@types/commonmark": "^0.27.0", - "@types/js-yaml": "^3.10.0", - "@types/jsonpath": "^0.1.29", - "@types/node": "^8.0.53", - "@types/source-map": "^0.5.0", - "@types/yargs": "^8.0.2", - "@types/z-schema": "^3.16.31", - "dts-generator": "^2.1.0", - "mocha": "^4.0.1", - "mocha-typescript": "^1.1.7", - "shx": "0.2.2", - "static-link": "^0.2.3", - "vscode-jsonrpc": "^3.3.1" - }, - "bundleDependencies": false, - "peerDependencies": {}, - "deprecated": false, - "_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", - "_shasum": "b3897b8615417aa07cf9113d4bd18862b32f82f8", - "_shrinkwrap": null, - "bin": { - "autorest-core": "./dist/app.js", - "autorest-language-service": "dist/language-service/language-service.js" - }, - "_id": "@microsoft.azure/autorest-core@2.0.4228", - "_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", - "_requested": { - "type": "directory", - "where": "D:\\VSProjects\\swagger-to-sdk", - "raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4228\\node_modules\\@microsoft.azure\\autorest-core", - "rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4228\\node_modules\\@microsoft.azure\\autorest-core", - "saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", - "fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core" - }, - "_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4228\\node_modules\\@microsoft.azure\\autorest-core", - "_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4228\\node_modules\\@microsoft.azure\\autorest-core" - }, - "extensionManager": { - "installationPath": "C:\\Users\\lmazuel\\.autorest", - "sharedLock": { - "name": "C:\\Users\\lmazuel\\.autorest", - "exclusiveLock": { - "name": "C__Users_lmazuel_.autorest.exclusive-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "exclusive": true - } - }, - "busyLock": { - "name": "C__Users_lmazuel_.autorest.busy-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "exclusive": true - } - }, - "personalLock": { - "name": "C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "exclusive": true - } - }, - "file": "C:\\Users\\lmazuel\\AppData\\Local\\Temp/C__Users_lmazuel_.autorest.lock" - }, - "dotnetPath": "C:\\Users\\lmazuel\\.dotnet" - }, - "installationPath": "C:\\Users\\lmazuel\\.autorest" - }, - { - "resolvedInfo": null, - "packageMetadata": { - "name": "@microsoft.azure/autorest-core", - "version": "2.0.4230", - "engines": { - "node": ">=7.10.0" - }, - "dependencies": {}, - "optionalDependencies": {}, - "devDependencies": { - "@types/commonmark": "^0.27.0", - "@types/js-yaml": "^3.10.0", - "@types/jsonpath": "^0.1.29", - "@types/node": "^8.0.53", - "@types/source-map": "0.5.0", - "@types/yargs": "^8.0.2", - "@types/z-schema": "^3.16.31", - "dts-generator": "^2.1.0", - "mocha": "^4.0.1", - "mocha-typescript": "^1.1.7", - "shx": "0.2.2", - "static-link": "^0.2.3", - "vscode-jsonrpc": "^3.3.1" - }, - "bundleDependencies": false, - "peerDependencies": {}, - "deprecated": false, - "_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", - "_shasum": "3c9b387fbe18ce3a54b68bc0c24ddb0a4c850f25", - "_shrinkwrap": null, - "bin": { - "autorest-core": "./dist/app.js", - "autorest-language-service": "dist/language-service/language-service.js" - }, - "_id": "@microsoft.azure/autorest-core@2.0.4230", - "_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", - "_requested": { - "type": "directory", - "where": "D:\\VSProjects\\swagger-to-sdk", - "raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4230\\node_modules\\@microsoft.azure\\autorest-core", - "rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4230\\node_modules\\@microsoft.azure\\autorest-core", - "saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", - "fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core" - }, - "_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4230\\node_modules\\@microsoft.azure\\autorest-core", - "_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest-core@2.0.4230\\node_modules\\@microsoft.azure\\autorest-core" - }, - "extensionManager": { - "installationPath": "C:\\Users\\lmazuel\\.autorest", - "sharedLock": { - "name": "C:\\Users\\lmazuel\\.autorest", - "exclusiveLock": { - "name": "C__Users_lmazuel_.autorest.exclusive-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "exclusive": true - } - }, - "busyLock": { - "name": "C__Users_lmazuel_.autorest.busy-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "exclusive": true - } - }, - "personalLock": { - "name": "C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "exclusive": true - } - }, - "file": "C:\\Users\\lmazuel\\AppData\\Local\\Temp/C__Users_lmazuel_.autorest.lock" - }, - "dotnetPath": "C:\\Users\\lmazuel\\.dotnet" - }, - "installationPath": "C:\\Users\\lmazuel\\.autorest" - }, - { - "resolvedInfo": null, - "packageMetadata": { - "name": "@microsoft.azure/autorest.modeler", - "version": "2.3.38", - "dependencies": { - "dotnet-2.0.0": "^1.4.4" - }, - "optionalDependencies": {}, - "devDependencies": { - "@microsoft.azure/autorest.testserver": "2.3.1", - "autorest": "^2.0.4201", - "coffee-script": "^1.11.1", - "dotnet-sdk-2.0.0": "^1.4.4", - "gulp": "^3.9.1", - "gulp-filter": "^5.0.0", - "gulp-line-ending-corrector": "^1.0.1", - "iced-coffee-script": "^108.0.11", - "marked": "^0.3.6", - "marked-terminal": "^2.0.0", - "moment": "^2.17.1", - "run-sequence": "*", - "shx": "^0.2.2", - "through2-parallel": "^0.1.3", - "yargs": "^8.0.2", - "yarn": "^1.0.2" - }, - "bundleDependencies": false, - "peerDependencies": {}, - "deprecated": false, - "_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", - "_shasum": "903bb77932e4ed1b8bc3b25cc39b167143494f6c", - "_shrinkwrap": null, - "bin": null, - "_id": "@microsoft.azure/autorest.modeler@2.3.38", - "_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", - "_requested": { - "type": "directory", - "where": "D:\\VSProjects\\swagger-to-sdk", - "raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.38\\node_modules\\@microsoft.azure\\autorest.modeler", - "rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.38\\node_modules\\@microsoft.azure\\autorest.modeler", - "saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", - "fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler" - }, - "_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.38\\node_modules\\@microsoft.azure\\autorest.modeler", - "_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.38\\node_modules\\@microsoft.azure\\autorest.modeler" - }, - "extensionManager": { - "installationPath": "C:\\Users\\lmazuel\\.autorest", - "sharedLock": { - "name": "C:\\Users\\lmazuel\\.autorest", - "exclusiveLock": { - "name": "C__Users_lmazuel_.autorest.exclusive-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "exclusive": true - } - }, - "busyLock": { - "name": "C__Users_lmazuel_.autorest.busy-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "exclusive": true - } - }, - "personalLock": { - "name": "C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "exclusive": true - } - }, - "file": "C:\\Users\\lmazuel\\AppData\\Local\\Temp/C__Users_lmazuel_.autorest.lock" - }, - "dotnetPath": "C:\\Users\\lmazuel\\.dotnet" - }, - "installationPath": "C:\\Users\\lmazuel\\.autorest" - }, - { - "resolvedInfo": null, - "packageMetadata": { - "name": "@microsoft.azure/autorest.modeler", - "version": "2.3.44", - "dependencies": { - "dotnet-2.0.0": "^1.4.4" - }, - "optionalDependencies": {}, - "devDependencies": { - "@microsoft.azure/autorest.testserver": "2.3.17", - "autorest": "^2.0.4225", - "coffee-script": "^1.11.1", - "dotnet-sdk-2.0.0": "^1.4.4", - "gulp": "^3.9.1", - "gulp-filter": "^5.0.0", - "gulp-line-ending-corrector": "^1.0.1", - "iced-coffee-script": "^108.0.11", - "marked": "^0.3.6", - "marked-terminal": "^2.0.0", - "moment": "^2.17.1", - "run-sequence": "*", - "shx": "^0.2.2", - "through2-parallel": "^0.1.3", - "yargs": "^8.0.2", - "yarn": "^1.0.2" - }, - "bundleDependencies": false, - "peerDependencies": {}, - "deprecated": false, - "_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", - "_shasum": "9b5a880a77467be33a77f002f03230d3ccc21266", - "_shrinkwrap": null, - "bin": null, - "_id": "@microsoft.azure/autorest.modeler@2.3.44", - "_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", - "_requested": { - "type": "directory", - "where": "D:\\VSProjects\\swagger-to-sdk", - "raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.44\\node_modules\\@microsoft.azure\\autorest.modeler", - "rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.44\\node_modules\\@microsoft.azure\\autorest.modeler", - "saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", - "fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler" - }, - "_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.44\\node_modules\\@microsoft.azure\\autorest.modeler", - "_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.modeler@2.3.44\\node_modules\\@microsoft.azure\\autorest.modeler" - }, - "extensionManager": { - "installationPath": "C:\\Users\\lmazuel\\.autorest", - "sharedLock": { - "name": "C:\\Users\\lmazuel\\.autorest", - "exclusiveLock": { - "name": "C__Users_lmazuel_.autorest.exclusive-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "exclusive": true - } - }, - "busyLock": { - "name": "C__Users_lmazuel_.autorest.busy-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "exclusive": true - } - }, - "personalLock": { - "name": "C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "exclusive": true - } - }, - "file": "C:\\Users\\lmazuel\\AppData\\Local\\Temp/C__Users_lmazuel_.autorest.lock" - }, - "dotnetPath": "C:\\Users\\lmazuel\\.dotnet" - }, - "installationPath": "C:\\Users\\lmazuel\\.autorest" - }, - { - "resolvedInfo": null, - "packageMetadata": { - "name": "@microsoft.azure/autorest.python", - "version": "2.1.34", - "dependencies": { - "dotnet-2.0.0": "^1.4.4" - }, - "optionalDependencies": {}, - "devDependencies": { - "@microsoft.azure/autorest.testserver": "^2.3.13", - "autorest": "^2.0.4203", - "coffee-script": "^1.11.1", - "dotnet-sdk-2.0.0": "^1.4.4", - "gulp": "^3.9.1", - "gulp-filter": "^5.0.0", - "gulp-line-ending-corrector": "^1.0.1", - "iced-coffee-script": "^108.0.11", - "marked": "^0.3.6", - "marked-terminal": "^2.0.0", - "moment": "^2.17.1", - "run-sequence": "*", - "shx": "^0.2.2", - "through2-parallel": "^0.1.3", - "yargs": "^8.0.2", - "yarn": "^1.0.2" - }, - "bundleDependencies": false, - "peerDependencies": {}, - "deprecated": false, - "_resolved": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", - "_shasum": "b58d7e0542e081cf410fdbcdf8c14acf9cee16a7", - "_shrinkwrap": null, - "bin": null, - "_id": "@microsoft.azure/autorest.python@2.1.34", - "_from": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", - "_requested": { - "type": "directory", - "where": "D:\\VSProjects\\swagger-to-sdk", - "raw": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.1.34\\node_modules\\@microsoft.azure\\autorest.python", - "rawSpec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.1.34\\node_modules\\@microsoft.azure\\autorest.python", - "saveSpec": "file:C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", - "fetchSpec": "C:/Users/lmazuel/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python" - }, - "_spec": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.1.34\\node_modules\\@microsoft.azure\\autorest.python", - "_where": "C:\\Users\\lmazuel\\.autorest\\@microsoft.azure_autorest.python@2.1.34\\node_modules\\@microsoft.azure\\autorest.python" - }, - "extensionManager": { - "installationPath": "C:\\Users\\lmazuel\\.autorest", - "sharedLock": { - "name": "C:\\Users\\lmazuel\\.autorest", - "exclusiveLock": { - "name": "C__Users_lmazuel_.autorest.exclusive-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.exclusive-lock", - "exclusive": true - } - }, - "busyLock": { - "name": "C__Users_lmazuel_.autorest.busy-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.busy-lock", - "exclusive": true - } - }, - "personalLock": { - "name": "C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "pipe": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "options": { - "path": "\\\\.\\pipe\\C__Users_lmazuel_.autorest.2919.7150139672835.personal-lock", - "exclusive": true - } - }, - "file": "C:\\Users\\lmazuel\\AppData\\Local\\Temp/C__Users_lmazuel_.autorest.lock" - }, - "dotnetPath": "C:\\Users\\lmazuel\\.dotnet" - }, - "installationPath": "C:\\Users\\lmazuel\\.autorest" - } - ], - "autorest_bootstrap": { - "dependencies": { - "autorest": { - "version": "2.0.4215", - "from": "autorest@latest", - "resolved": "https://registry.npmjs.org/autorest/-/autorest-2.0.4215.tgz" - } - } - } -} \ No newline at end of file diff --git a/azure-cognitiveservices-language-textanalytics/tests/recordings/test_detect_language.yaml b/azure-cognitiveservices-language-textanalytics/tests/recordings/test_detect_language.yaml index 6e11f4ff8e1c..82a16c118182 100644 --- a/azure-cognitiveservices-language-textanalytics/tests/recordings/test_detect_language.yaml +++ b/azure-cognitiveservices-language-textanalytics/tests/recordings/test_detect_language.yaml @@ -8,19 +8,20 @@ interactions: Connection: [keep-alive] Content-Length: ['121'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.15063-SP0) requests/2.18.4 msrest/0.4.17 - textanalyticsapi/v2.0] + User-Agent: [python/3.6.6 (Windows-10-10.0.17763-SP0) msrest/0.6.1 azure-cognitiveservices-language-textanalytics/0.2.0] + X-BingApis-SDK-Client: [Python-SDK] method: POST - uri: https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0/languages + uri: https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.1/languages response: body: {string: '{"documents":[{"id":"1","detectedLanguages":[{"name":"English","iso6391Name":"en","score":1.0}]}],"errors":[]}'} headers: - apim-request-id: [9be4d744-07aa-40e2-b9e6-0d07aaca6ea7] + apim-request-id: [80c2eed0-76c2-4b6d-a42c-6d91f1bb35af] content-type: [application/json; charset=utf-8] - date: ['Thu, 19 Oct 2017 22:02:20 GMT'] + csp-billing-usage: [CognitiveServices.TextAnalytics.BatchScoring|1] + date: ['Tue, 12 Mar 2019 21:02:21 GMT'] strict-transport-security: [max-age=31536000; includeSubDomains; preload] transfer-encoding: [chunked] - x-aml-ta-request-id: [038c732a-e9f8-4419-8299-1c718464d093] + x-aml-ta-request-id: [3211bf52-3057-40a2-ad42-98a0294aaf6d] x-content-type-options: [nosniff] x-ms-transaction-count: ['1'] status: {code: 200, message: OK} diff --git a/azure-cognitiveservices-language-textanalytics/tests/test_text_analytics.py b/azure-cognitiveservices-language-textanalytics/tests/test_text_analytics.py index 793487178ab3..2e87aefb54f4 100644 --- a/azure-cognitiveservices-language-textanalytics/tests/test_text_analytics.py +++ b/azure-cognitiveservices-language-textanalytics/tests/test_text_analytics.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.cognitiveservices.language.textanalytics import TextAnalyticsAPI +from azure.cognitiveservices.language.textanalytics import TextAnalyticsClient from msrest.authentication import CognitiveServicesCredentials from azure_devtools.scenario_tests import ReplayableTest, AzureTestError @@ -45,7 +45,7 @@ def test_detect_language(self): credentials = CognitiveServicesCredentials( self.settings.CS_SUBSCRIPTION_KEY ) - text_analytics = TextAnalyticsAPI("westcentralus", credentials=credentials) + text_analytics = TextAnalyticsClient(endpoint="https://westcentralus.api.cognitive.microsoft.com", credentials=credentials) response = text_analytics.detect_language( documents=[{ 'id': 1,