diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py index 9a75fc1a0e69..48d59a14cb3c 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .text_analytics_client import TextAnalyticsClient -from .version import VERSION +from ._configuration import TextAnalyticsClientConfiguration +from ._text_analytics_client import TextAnalyticsClient +__all__ = ['TextAnalyticsClient', 'TextAnalyticsClientConfiguration'] -__all__ = ['TextAnalyticsClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/_configuration.py new file mode 100644 index 000000000000..11cdcbe23fc2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/_configuration.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 import Configuration + +from .version import VERSION + + +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/v3.1-preview.3' + + super(TextAnalyticsClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-cognitiveservices-language-textanalytics/{}'.format(VERSION)) + + self.endpoint = endpoint + self.credentials = credentials diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/_text_analytics_client.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/_text_analytics_client.py new file mode 100644 index 000000000000..633299e0717b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/_text_analytics_client.py @@ -0,0 +1,45 @@ +# 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 Serializer, Deserializer + +from ._configuration import TextAnalyticsClientConfiguration +from .operations import TextAnalyticsClientOperationsMixin +from msrest.exceptions import HttpOperationError +from . import models + + +class TextAnalyticsClient(TextAnalyticsClientOperationsMixin, SDKClient): + """The Text Analytics API is a suite of natural language processing (NLP) 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. Further documentation can be found in <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview">https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview</a> + + :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 = 'v3.1-preview.3' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py index be4003cc1ae8..43959e25f1a6 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/__init__.py @@ -10,67 +10,206 @@ # -------------------------------------------------------------------------- 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 + from ._models_py3 import AnalyzeBatchInput + from ._models_py3 import AnalyzeJobState + from ._models_py3 import AnalyzeJobStateTasks + from ._models_py3 import AnalyzeJobStateTasksDetails + from ._models_py3 import AnalyzeJobStateTasksEntityRecognitionPiiTasksItem + from ._models_py3 import AnalyzeJobStateTasksEntityRecognitionTasksItem + from ._models_py3 import AnalyzeJobStateTasksKeyPhraseExtractionTasksItem + from ._models_py3 import AspectConfidenceScoreLabel + from ._models_py3 import AspectRelation + from ._models_py3 import DetectedLanguage + from ._models_py3 import DocumentEntities + from ._models_py3 import DocumentError + from ._models_py3 import DocumentHealthcareEntities + from ._models_py3 import DocumentKeyPhrases + from ._models_py3 import DocumentLanguage + from ._models_py3 import DocumentLinkedEntities + from ._models_py3 import DocumentSentiment + from ._models_py3 import DocumentStatistics + from ._models_py3 import EntitiesResult + from ._models_py3 import EntitiesTask + from ._models_py3 import EntitiesTaskParameters + from ._models_py3 import Entity + from ._models_py3 import EntityLinkingResult + from ._models_py3 import ErrorResponse + from ._models_py3 import HealthcareEntity + from ._models_py3 import HealthcareEntityLink + from ._models_py3 import HealthcareJobState + from ._models_py3 import HealthcareRelation + from ._models_py3 import HealthcareResult + from ._models_py3 import InnerError + from ._models_py3 import JobDescriptor + from ._models_py3 import JobManifest + from ._models_py3 import JobManifestTasks + from ._models_py3 import JobMetadata + from ._models_py3 import KeyPhraseResult + from ._models_py3 import KeyPhrasesTask + from ._models_py3 import KeyPhrasesTaskParameters + from ._models_py3 import LanguageBatchInput + from ._models_py3 import LanguageInput + from ._models_py3 import LanguageResult + from ._models_py3 import LinkedEntity + from ._models_py3 import Match + from ._models_py3 import MultiLanguageBatchInput + from ._models_py3 import MultiLanguageInput + from ._models_py3 import Pagination + from ._models_py3 import PiiDocumentEntities + from ._models_py3 import PiiResult + from ._models_py3 import PiiTask + from ._models_py3 import PiiTaskParameters + from ._models_py3 import RequestStatistics + from ._models_py3 import SentenceAspect + from ._models_py3 import SentenceOpinion + from ._models_py3 import SentenceSentiment + from ._models_py3 import SentimentConfidenceScorePerLabel + from ._models_py3 import SentimentResponse + from ._models_py3 import TasksState + from ._models_py3 import TaskState + from ._models_py3 import TextAnalyticsError + from ._models_py3 import TextAnalyticsWarning 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 + from ._models import AnalyzeBatchInput + from ._models import AnalyzeJobState + from ._models import AnalyzeJobStateTasks + from ._models import AnalyzeJobStateTasksDetails + from ._models import AnalyzeJobStateTasksEntityRecognitionPiiTasksItem + from ._models import AnalyzeJobStateTasksEntityRecognitionTasksItem + from ._models import AnalyzeJobStateTasksKeyPhraseExtractionTasksItem + from ._models import AspectConfidenceScoreLabel + from ._models import AspectRelation + from ._models import DetectedLanguage + from ._models import DocumentEntities + from ._models import DocumentError + from ._models import DocumentHealthcareEntities + from ._models import DocumentKeyPhrases + from ._models import DocumentLanguage + from ._models import DocumentLinkedEntities + from ._models import DocumentSentiment + from ._models import DocumentStatistics + from ._models import EntitiesResult + from ._models import EntitiesTask + from ._models import EntitiesTaskParameters + from ._models import Entity + from ._models import EntityLinkingResult + from ._models import ErrorResponse + from ._models import HealthcareEntity + from ._models import HealthcareEntityLink + from ._models import HealthcareJobState + from ._models import HealthcareRelation + from ._models import HealthcareResult + from ._models import InnerError + from ._models import JobDescriptor + from ._models import JobManifest + from ._models import JobManifestTasks + from ._models import JobMetadata + from ._models import KeyPhraseResult + from ._models import KeyPhrasesTask + from ._models import KeyPhrasesTaskParameters + from ._models import LanguageBatchInput + from ._models import LanguageInput + from ._models import LanguageResult + from ._models import LinkedEntity + from ._models import Match + from ._models import MultiLanguageBatchInput + from ._models import MultiLanguageInput + from ._models import Pagination + from ._models import PiiDocumentEntities + from ._models import PiiResult + from ._models import PiiTask + from ._models import PiiTaskParameters + from ._models import RequestStatistics + from ._models import SentenceAspect + from ._models import SentenceOpinion + from ._models import SentenceSentiment + from ._models import SentimentConfidenceScorePerLabel + from ._models import SentimentResponse + from ._models import TasksState + from ._models import TaskState + from ._models import TextAnalyticsError + from ._models import TextAnalyticsWarning +from ._text_analytics_client_enums import ( + AspectRelationType, + DocumentSentimentValue, + ErrorCodeValue, + InnerErrorCodeValue, + SentenceSentimentValue, + State, + StringIndexType, + StringIndexTypeResponse, + TokenSentimentValue, + WarningCodeValue, +) __all__ = [ - 'MultiLanguageInput', - 'MultiLanguageBatchInput', - 'MatchRecord', - 'EntityRecord', + 'AnalyzeBatchInput', + 'AnalyzeJobState', + 'AnalyzeJobStateTasks', + 'AnalyzeJobStateTasksDetails', + 'AnalyzeJobStateTasksEntityRecognitionPiiTasksItem', + 'AnalyzeJobStateTasksEntityRecognitionTasksItem', + 'AnalyzeJobStateTasksKeyPhraseExtractionTasksItem', + 'AspectConfidenceScoreLabel', + 'AspectRelation', + 'DetectedLanguage', + 'DocumentEntities', + 'DocumentError', + 'DocumentHealthcareEntities', + 'DocumentKeyPhrases', + 'DocumentLanguage', + 'DocumentLinkedEntities', + 'DocumentSentiment', 'DocumentStatistics', - 'EntitiesBatchResultItem', - 'ErrorRecord', - 'RequestStatistics', - 'EntitiesBatchResult', - 'InternalError', - 'ErrorResponse', 'ErrorResponseException', - 'KeyPhraseBatchResultItem', - 'KeyPhraseBatchResult', - 'LanguageInput', + 'EntitiesResult', + 'EntitiesTask', + 'EntitiesTaskParameters', + 'Entity', + 'EntityLinkingResult', + 'ErrorResponse', + 'HealthcareEntity', + 'HealthcareEntityLink', + 'HealthcareJobState', + 'HealthcareRelation', + 'HealthcareResult', + 'InnerError', + 'JobDescriptor', + 'JobManifest', + 'JobManifestTasks', + 'JobMetadata', + 'KeyPhraseResult', + 'KeyPhrasesTask', + 'KeyPhrasesTaskParameters', 'LanguageBatchInput', - 'DetectedLanguage', - 'LanguageBatchResultItem', - 'LanguageBatchResult', - 'SentimentBatchResultItem', - 'SentimentBatchResult', + 'LanguageInput', + 'LanguageResult', + 'LinkedEntity', + 'Match', + 'MultiLanguageBatchInput', + 'MultiLanguageInput', + 'Pagination', + 'PiiDocumentEntities', + 'PiiResult', + 'PiiTask', + 'PiiTaskParameters', + 'RequestStatistics', + 'SentenceAspect', + 'SentenceOpinion', + 'SentenceSentiment', + 'SentimentConfidenceScorePerLabel', + 'SentimentResponse', + 'TasksState', + 'TaskState', + 'TextAnalyticsError', + 'TextAnalyticsWarning', + 'StringIndexTypeResponse', + 'ErrorCodeValue', + 'InnerErrorCodeValue', + 'WarningCodeValue', + 'State', + 'DocumentSentimentValue', + 'SentenceSentimentValue', + 'TokenSentimentValue', + 'AspectRelationType', + 'StringIndexType', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_models.py new file mode 100644 index 000000000000..dae3429caefa --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_models.py @@ -0,0 +1,2157 @@ +# 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 AnalyzeBatchInput(Model): + """AnalyzeBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param display_name: Optional display name for the analysis job. + :type display_name: str + :param analysis_input: Required. + :type analysis_input: + ~azure.cognitiveservices.language.textanalytics.models.MultiLanguageBatchInput + :param tasks: Required. The set of tasks to execute on the input + documents. Cannot specify the same task more than once. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.JobManifestTasks + """ + + _validation = { + 'analysis_input': {'required': True}, + 'tasks': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'analysis_input': {'key': 'analysisInput', 'type': 'MultiLanguageBatchInput'}, + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + } + + def __init__(self, **kwargs): + super(AnalyzeBatchInput, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.analysis_input = kwargs.get('analysis_input', None) + self.tasks = kwargs.get('tasks', None) + + +class AnalyzeJobState(Model): + """AnalyzeJobState. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: datetime + :param display_name: + :type display_name: str + :param expiration_date_time: + :type expiration_date_time: datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param status: Required. Possible values include: 'notStarted', 'running', + 'succeeded', 'failed', 'cancelled', 'cancelling', 'partiallyCompleted' + :type status: str or + ~azure.cognitiveservices.language.textanalytics.models.State + :param tasks: Required. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasks + :param errors: + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param next_link: + :type next_link: str + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'tasks': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'State'}, + 'tasks': {'key': 'tasks', 'type': 'AnalyzeJobStateTasks'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AnalyzeJobState, self).__init__(**kwargs) + self.created_date_time = kwargs.get('created_date_time', None) + self.display_name = kwargs.get('display_name', None) + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs.get('job_id', None) + self.last_update_date_time = kwargs.get('last_update_date_time', None) + self.status = kwargs.get('status', None) + self.tasks = kwargs.get('tasks', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.next_link = kwargs.get('next_link', None) + + +class AnalyzeJobStateTasks(Model): + """AnalyzeJobStateTasks. + + All required parameters must be populated in order to send to Azure. + + :param details: + :type details: + ~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksDetails + :param completed: Required. + :type completed: int + :param failed: Required. + :type failed: int + :param in_progress: Required. + :type in_progress: int + :param total: Required. + :type total: int + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksEntityRecognitionTasksItem] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksEntityRecognitionPiiTasksItem] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksKeyPhraseExtractionTasksItem] + """ + + _validation = { + 'completed': {'required': True}, + 'failed': {'required': True}, + 'in_progress': {'required': True}, + 'total': {'required': True}, + } + + _attribute_map = { + 'details': {'key': 'details', 'type': 'AnalyzeJobStateTasksDetails'}, + 'completed': {'key': 'completed', 'type': 'int'}, + 'failed': {'key': 'failed', 'type': 'int'}, + 'in_progress': {'key': 'inProgress', 'type': 'int'}, + 'total': {'key': 'total', 'type': 'int'}, + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[AnalyzeJobStateTasksEntityRecognitionTasksItem]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[AnalyzeJobStateTasksEntityRecognitionPiiTasksItem]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[AnalyzeJobStateTasksKeyPhraseExtractionTasksItem]'}, + } + + def __init__(self, **kwargs): + super(AnalyzeJobStateTasks, self).__init__(**kwargs) + self.details = kwargs.get('details', None) + self.completed = kwargs.get('completed', None) + self.failed = kwargs.get('failed', None) + self.in_progress = kwargs.get('in_progress', None) + self.total = kwargs.get('total', None) + self.entity_recognition_tasks = kwargs.get('entity_recognition_tasks', None) + self.entity_recognition_pii_tasks = kwargs.get('entity_recognition_pii_tasks', None) + self.key_phrase_extraction_tasks = kwargs.get('key_phrase_extraction_tasks', None) + + +class TaskState(Model): + """TaskState. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(TaskState, self).__init__(**kwargs) + self.last_update_date_time = kwargs.get('last_update_date_time', None) + self.name = kwargs.get('name', None) + self.status = kwargs.get('status', None) + + +class AnalyzeJobStateTasksDetails(TaskState): + """AnalyzeJobStateTasksDetails. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(AnalyzeJobStateTasksDetails, self).__init__(**kwargs) + + +class AnalyzeJobStateTasksEntityRecognitionPiiTasksItem(TaskState): + """AnalyzeJobStateTasksEntityRecognitionPiiTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + :param results: Required. + :type results: + ~azure.cognitiveservices.language.textanalytics.models.PiiResult + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'results': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + 'results': {'key': 'results', 'type': 'PiiResult'}, + } + + def __init__(self, **kwargs): + super(AnalyzeJobStateTasksEntityRecognitionPiiTasksItem, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class AnalyzeJobStateTasksEntityRecognitionTasksItem(TaskState): + """AnalyzeJobStateTasksEntityRecognitionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + :param results: Required. + :type results: + ~azure.cognitiveservices.language.textanalytics.models.EntitiesResult + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'results': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + 'results': {'key': 'results', 'type': 'EntitiesResult'}, + } + + def __init__(self, **kwargs): + super(AnalyzeJobStateTasksEntityRecognitionTasksItem, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class AnalyzeJobStateTasksKeyPhraseExtractionTasksItem(TaskState): + """AnalyzeJobStateTasksKeyPhraseExtractionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + :param results: Required. + :type results: + ~azure.cognitiveservices.language.textanalytics.models.KeyPhraseResult + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'results': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + 'results': {'key': 'results', 'type': 'KeyPhraseResult'}, + } + + def __init__(self, **kwargs): + super(AnalyzeJobStateTasksKeyPhraseExtractionTasksItem, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class AspectConfidenceScoreLabel(Model): + """Represents the confidence scores across all sentiment classes: positive, + neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(AspectConfidenceScoreLabel, self).__init__(**kwargs) + self.positive = kwargs.get('positive', None) + self.negative = kwargs.get('negative', None) + + +class AspectRelation(Model): + """AspectRelation. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. The type related to the aspect. Possible + values include: 'opinion', 'aspect' + :type relation_type: str or + ~azure.cognitiveservices.language.textanalytics.models.AspectRelationType + :param ref: Required. The JSON pointer indicating the linked object. + :type ref: str + """ + + _validation = { + 'relation_type': {'required': True}, + 'ref': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'AspectRelationType'}, + 'ref': {'key': 'ref', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AspectRelation, self).__init__(**kwargs) + self.relation_type = kwargs.get('relation_type', None) + self.ref = kwargs.get('ref', None) + + +class DetectedLanguage(Model): + """DetectedLanguage. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Long name of a detected language (e.g. English, + French). + :type name: str + :param iso6391_name: Required. A two letter representation of the detected + language according to the ISO 639-1 standard (e.g. en, fr). + :type iso6391_name: str + :param confidence_score: Required. A confidence score between 0 and 1. + Scores close to 1 indicate 100% certainty that the identified language is + true. + :type confidence_score: float + """ + + _validation = { + 'name': {'required': True}, + 'iso6391_name': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'iso6391_name': {'key': 'iso6391Name', 'type': 'str'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(DetectedLanguage, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.iso6391_name = kwargs.get('iso6391_name', None) + self.confidence_score = kwargs.get('confidence_score', None) + + +class DocumentEntities(Model): + """DocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized entities in the document. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, **kwargs): + super(DocumentEntities, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.entities = kwargs.get('entities', None) + self.warnings = kwargs.get('warnings', None) + self.statistics = kwargs.get('statistics', None) + + +class DocumentError(Model): + """DocumentError. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Document Id. + :type id: str + :param error: Required. Document Error. + :type error: + ~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError + """ + + _validation = { + 'id': {'required': True}, + 'error': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__(self, **kwargs): + super(DocumentError, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.error = kwargs.get('error', None) + + +class DocumentHealthcareEntities(Model): + """DocumentHealthcareEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Healthcare entities. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.HealthcareEntity] + :param relations: Required. Healthcare entity relations. + :type relations: + list[~azure.cognitiveservices.language.textanalytics.models.HealthcareRelation] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'entities': {'required': True}, + 'relations': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[HealthcareEntity]'}, + 'relations': {'key': 'relations', 'type': '[HealthcareRelation]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, **kwargs): + super(DocumentHealthcareEntities, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.entities = kwargs.get('entities', None) + self.relations = kwargs.get('relations', None) + self.warnings = kwargs.get('warnings', None) + self.statistics = kwargs.get('statistics', None) + + +class DocumentKeyPhrases(Model): + """DocumentKeyPhrases. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param key_phrases: Required. A list of representative words or phrases. + The number of key phrases returned is proportional to the number of words + in the input document. + :type key_phrases: list[str] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'key_phrases': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'key_phrases': {'key': 'keyPhrases', 'type': '[str]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, **kwargs): + super(DocumentKeyPhrases, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.key_phrases = kwargs.get('key_phrases', None) + self.warnings = kwargs.get('warnings', None) + self.statistics = kwargs.get('statistics', None) + + +class DocumentLanguage(Model): + """DocumentLanguage. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param detected_language: Required. Detected Language. + :type detected_language: + ~azure.cognitiveservices.language.textanalytics.models.DetectedLanguage + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'detected_language': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'detected_language': {'key': 'detectedLanguage', 'type': 'DetectedLanguage'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, **kwargs): + super(DocumentLanguage, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.detected_language = kwargs.get('detected_language', None) + self.warnings = kwargs.get('warnings', None) + self.statistics = kwargs.get('statistics', None) + + +class DocumentLinkedEntities(Model): + """DocumentLinkedEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized well-known entities in the document. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.LinkedEntity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[LinkedEntity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, **kwargs): + super(DocumentLinkedEntities, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.entities = kwargs.get('entities', None) + self.warnings = kwargs.get('warnings', None) + self.statistics = kwargs.get('statistics', None) + + +class DocumentSentiment(Model): + """DocumentSentiment. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param sentiment: Required. Predicted sentiment for document (Negative, + Neutral, Positive, or Mixed). Possible values include: 'positive', + 'neutral', 'negative', 'mixed' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.DocumentSentimentValue + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics + :param confidence_scores: Required. Document level sentiment confidence + scores between 0 and 1 for each sentiment class. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.SentimentConfidenceScorePerLabel + :param sentences: Required. Sentence level sentiment analysis. + :type sentences: + list[~azure.cognitiveservices.language.textanalytics.models.SentenceSentiment] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + """ + + _validation = { + 'id': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'sentences': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'DocumentSentimentValue'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'sentences': {'key': 'sentences', 'type': '[SentenceSentiment]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + } + + def __init__(self, **kwargs): + super(DocumentSentiment, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.sentiment = kwargs.get('sentiment', None) + self.statistics = kwargs.get('statistics', None) + self.confidence_scores = kwargs.get('confidence_scores', None) + self.sentences = kwargs.get('sentences', None) + self.warnings = kwargs.get('warnings', None) + + +class DocumentStatistics(Model): + """if showStats=true was specified in the request this field will contain + information about the document payload. + + All required parameters must be populated in order to send to Azure. + + :param characters_count: Required. Number of text elements recognized in + the document. + :type characters_count: int + :param transactions_count: Required. Number of transactions for the + document. + :type transactions_count: int + """ + + _validation = { + 'characters_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _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) + + +class EntitiesResult(Model): + """EntitiesResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EntitiesResult, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs.get('model_version', None) + + +class EntitiesTask(Model): + """EntitiesTask. + + :param parameters: + :type parameters: + ~azure.cognitiveservices.language.textanalytics.models.EntitiesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'EntitiesTaskParameters'}, + } + + def __init__(self, **kwargs): + super(EntitiesTask, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class EntitiesTaskParameters(Model): + """EntitiesTaskParameters. + + :param model_version: Default value: "latest" . + :type model_version: str + :param string_index_type: Possible values include: 'TextElements_v8', + 'UnicodeCodePoint', 'Utf16CodeUnit'. Default value: "TextElements_v8" . + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'StringIndexTypeResponse'}, + } + + def __init__(self, **kwargs): + super(EntitiesTaskParameters, self).__init__(**kwargs) + self.model_version = kwargs.get('model_version', "latest") + self.string_index_type = kwargs.get('string_index_type', "TextElements_v8") + + +class Entity(Model): + """Entity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of + different 'stringIndexType' values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different + 'stringIndexType' values can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the + extracted entity. + :type confidence_score: float + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(Entity, self).__init__(**kwargs) + self.text = kwargs.get('text', None) + self.category = kwargs.get('category', None) + self.subcategory = kwargs.get('subcategory', None) + self.offset = kwargs.get('offset', None) + self.length = kwargs.get('length', None) + self.confidence_score = kwargs.get('confidence_score', None) + + +class EntityLinkingResult(Model): + """EntityLinkingResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentLinkedEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLinkedEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EntityLinkingResult, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs.get('model_version', None) + + +class ErrorResponse(Model): + """ErrorResponse. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. Document Error. + :type error: + ~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class HealthcareEntity(Entity): + """HealthcareEntity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of + different 'stringIndexType' values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different + 'stringIndexType' values can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the + extracted entity. + :type confidence_score: float + :param is_negated: Required. + :type is_negated: bool + :param links: Entity references in known data sources. + :type links: + list[~azure.cognitiveservices.language.textanalytics.models.HealthcareEntityLink] + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + 'is_negated': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'is_negated': {'key': 'isNegated', 'type': 'bool'}, + 'links': {'key': 'links', 'type': '[HealthcareEntityLink]'}, + } + + def __init__(self, **kwargs): + super(HealthcareEntity, self).__init__(**kwargs) + self.is_negated = kwargs.get('is_negated', None) + self.links = kwargs.get('links', None) + + +class HealthcareEntityLink(Model): + """HealthcareEntityLink. + + All required parameters must be populated in order to send to Azure. + + :param data_source: Required. Entity Catalog. Examples include: UMLS, CHV, + MSH, etc. + :type data_source: str + :param id: Required. Entity id in the given source catalog. + :type id: str + """ + + _validation = { + 'data_source': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HealthcareEntityLink, self).__init__(**kwargs) + self.data_source = kwargs.get('data_source', None) + self.id = kwargs.get('id', None) + + +class HealthcareJobState(Model): + """HealthcareJobState. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: datetime + :param display_name: + :type display_name: str + :param expiration_date_time: + :type expiration_date_time: datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param status: Required. Possible values include: 'notStarted', 'running', + 'succeeded', 'failed', 'cancelled', 'cancelling', 'partiallyCompleted' + :type status: str or + ~azure.cognitiveservices.language.textanalytics.models.State + :param results: + :type results: + ~azure.cognitiveservices.language.textanalytics.models.HealthcareResult + :param errors: + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError] + :param next_link: + :type next_link: str + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'State'}, + 'results': {'key': 'results', 'type': 'HealthcareResult'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HealthcareJobState, self).__init__(**kwargs) + self.created_date_time = kwargs.get('created_date_time', None) + self.display_name = kwargs.get('display_name', None) + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs.get('job_id', None) + self.last_update_date_time = kwargs.get('last_update_date_time', None) + self.status = kwargs.get('status', None) + self.results = kwargs.get('results', None) + self.errors = kwargs.get('errors', None) + self.next_link = kwargs.get('next_link', None) + + +class HealthcareRelation(Model): + """HealthcareRelation. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. Type of relation. Examples include: + `DosageOfMedication` or 'FrequencyOfMedication', etc. + :type relation_type: str + :param bidirectional: Required. If true the relation between the entities + is bidirectional, otherwise directionality is source to target. + :type bidirectional: bool + :param source: Required. Reference link to the source entity. + :type source: str + :param target: Required. Reference link to the target entity. + :type target: str + """ + + _validation = { + 'relation_type': {'required': True}, + 'bidirectional': {'required': True}, + 'source': {'required': True}, + 'target': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'str'}, + 'bidirectional': {'key': 'bidirectional', 'type': 'bool'}, + 'source': {'key': 'source', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HealthcareRelation, self).__init__(**kwargs) + self.relation_type = kwargs.get('relation_type', None) + self.bidirectional = kwargs.get('bidirectional', None) + self.source = kwargs.get('source', None) + self.target = kwargs.get('target', None) + + +class HealthcareResult(Model): + """HealthcareResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentHealthcareEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentHealthcareEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HealthcareResult, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs.get('model_version', None) + + +class InnerError(Model): + """InnerError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: + 'InvalidParameterValue', 'InvalidRequestBodyFormat', 'EmptyRequest', + 'MissingInputRecords', 'InvalidDocument', 'ModelVersionIncorrect', + 'InvalidDocumentBatch', 'UnsupportedLanguageCode', 'InvalidCountryHint' + :type code: str or + ~azure.cognitiveservices.language.textanalytics.models.InnerErrorCodeValue + :param message: Required. Error message. + :type message: str + :param details: Error details. + :type details: dict[str, str] + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: + ~azure.cognitiveservices.language.textanalytics.models.InnerError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '{str}'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + } + + def __init__(self, **kwargs): + super(InnerError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + self.target = kwargs.get('target', None) + self.innererror = kwargs.get('innererror', None) + + +class JobDescriptor(Model): + """JobDescriptor. + + :param display_name: Optional display name for the analysis job. + :type display_name: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(JobDescriptor, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + + +class JobManifest(Model): + """JobManifest. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. The set of tasks to execute on the input + documents. Cannot specify the same task more than once. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.JobManifestTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + } + + def __init__(self, **kwargs): + super(JobManifest, self).__init__(**kwargs) + self.tasks = kwargs.get('tasks', None) + + +class JobManifestTasks(Model): + """The set of tasks to execute on the input documents. Cannot specify the same + task more than once. + + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.EntitiesTask] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.PiiTask] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.KeyPhrasesTask] + """ + + _attribute_map = { + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[EntitiesTask]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[PiiTask]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[KeyPhrasesTask]'}, + } + + def __init__(self, **kwargs): + super(JobManifestTasks, self).__init__(**kwargs) + self.entity_recognition_tasks = kwargs.get('entity_recognition_tasks', None) + self.entity_recognition_pii_tasks = kwargs.get('entity_recognition_pii_tasks', None) + self.key_phrase_extraction_tasks = kwargs.get('key_phrase_extraction_tasks', None) + + +class JobMetadata(Model): + """JobMetadata. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: datetime + :param display_name: + :type display_name: str + :param expiration_date_time: + :type expiration_date_time: datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param status: Required. Possible values include: 'notStarted', 'running', + 'succeeded', 'failed', 'cancelled', 'cancelling', 'partiallyCompleted' + :type status: str or + ~azure.cognitiveservices.language.textanalytics.models.State + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'State'}, + } + + def __init__(self, **kwargs): + super(JobMetadata, self).__init__(**kwargs) + self.created_date_time = kwargs.get('created_date_time', None) + self.display_name = kwargs.get('display_name', None) + self.expiration_date_time = kwargs.get('expiration_date_time', None) + self.job_id = kwargs.get('job_id', None) + self.last_update_date_time = kwargs.get('last_update_date_time', None) + self.status = kwargs.get('status', None) + + +class KeyPhraseResult(Model): + """KeyPhraseResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentKeyPhrases] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentKeyPhrases]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyPhraseResult, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs.get('model_version', None) + + +class KeyPhrasesTask(Model): + """KeyPhrasesTask. + + :param parameters: + :type parameters: + ~azure.cognitiveservices.language.textanalytics.models.KeyPhrasesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'KeyPhrasesTaskParameters'}, + } + + def __init__(self, **kwargs): + super(KeyPhrasesTask, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class KeyPhrasesTaskParameters(Model): + """KeyPhrasesTaskParameters. + + :param model_version: Default value: "latest" . + :type model_version: str + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyPhrasesTaskParameters, self).__init__(**kwargs) + self.model_version = kwargs.get('model_version', "latest") + + +class LanguageBatchInput(Model): + """LanguageBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.LanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[LanguageInput]'}, + } + + def __init__(self, **kwargs): + super(LanguageBatchInput, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + + +class LanguageInput(Model): + """LanguageInput. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param text: Required. + :type text: str + :param country_hint: + :type country_hint: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'country_hint': {'key': 'countryHint', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LanguageInput, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.text = kwargs.get('text', None) + self.country_hint = kwargs.get('country_hint', None) + + +class LanguageResult(Model): + """LanguageResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentLanguage] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLanguage]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LanguageResult, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs.get('model_version', None) + + +class LinkedEntity(Model): + """LinkedEntity. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Entity Linking formal name. + :type name: str + :param matches: Required. List of instances this entity appears in the + text. + :type matches: + list[~azure.cognitiveservices.language.textanalytics.models.Match] + :param language: Required. Language used in the data source. + :type language: str + :param id: Unique identifier of the recognized entity from the data + source. + :type id: str + :param url: Required. URL for the entity's page from the data source. + :type url: str + :param data_source: Required. Data source used to extract entity linking, + such as Wiki/Bing etc. + :type data_source: str + :param bing_id: Bing Entity Search API unique identifier of the recognized + entity. + :type bing_id: str + """ + + _validation = { + 'name': {'required': True}, + 'matches': {'required': True}, + 'language': {'required': True}, + 'url': {'required': True}, + 'data_source': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'matches': {'key': 'matches', 'type': '[Match]'}, + 'language': {'key': 'language', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LinkedEntity, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.matches = kwargs.get('matches', None) + self.language = kwargs.get('language', None) + self.id = kwargs.get('id', None) + self.url = kwargs.get('url', None) + self.data_source = kwargs.get('data_source', None) + self.bing_id = kwargs.get('bing_id', None) + + +class Match(Model): + """Match. + + All required parameters must be populated in order to send to Azure. + + :param confidence_score: Required. If a well-known item is recognized, a + decimal number denoting the confidence level between 0 and 1 will be + returned. + :type confidence_score: float + :param text: Required. Entity text as appears in the request. + :type text: str + :param offset: Required. Start position for the entity match text. + :type offset: int + :param length: Required. Length for the entity match text. + :type length: int + """ + + _validation = { + 'confidence_score': {'required': True}, + 'text': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'text': {'key': 'text', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Match, self).__init__(**kwargs) + self.confidence_score = kwargs.get('confidence_score', None) + self.text = kwargs.get('text', None) + self.offset = kwargs.get('offset', None) + self.length = kwargs.get('length', None) + + +class MultiLanguageBatchInput(Model): + """Contains a set of input documents to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. The set of documents to process as part of + this batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[MultiLanguageInput]'}, + } + + def __init__(self, **kwargs): + super(MultiLanguageBatchInput, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + + +class MultiLanguageInput(Model): + """Contains an input document to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A unique, non-empty document identifier. + :type id: str + :param text: Required. The input text to process. + :type text: str + :param language: (Optional) This is the 2 letter ISO 639-1 representation + of a language. For example, use "en" for English; "es" for Spanish etc. If + not set, use "en" for English as default. + :type language: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MultiLanguageInput, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.text = kwargs.get('text', None) + self.language = kwargs.get('language', None) + + +class Pagination(Model): + """Pagination. + + :param next_link: + :type next_link: str + """ + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Pagination, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + + +class PiiDocumentEntities(Model): + """PiiDocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param redacted_text: Required. Returns redacted text. + :type redacted_text: str + :param entities: Required. Recognized entities in the document. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'redacted_text': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'redacted_text': {'key': 'redactedText', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, **kwargs): + super(PiiDocumentEntities, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.redacted_text = kwargs.get('redacted_text', None) + self.entities = kwargs.get('entities', None) + self.warnings = kwargs.get('warnings', None) + self.statistics = kwargs.get('statistics', None) + + +class PiiResult(Model): + """PiiResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.PiiDocumentEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[PiiDocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PiiResult, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs.get('model_version', None) + + +class PiiTask(Model): + """PiiTask. + + :param parameters: + :type parameters: + ~azure.cognitiveservices.language.textanalytics.models.PiiTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'PiiTaskParameters'}, + } + + def __init__(self, **kwargs): + super(PiiTask, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class PiiTaskParameters(Model): + """PiiTaskParameters. + + :param domain: Possible values include: 'phi', 'none'. Default value: + "none" . + :type domain: str or + ~azure.cognitiveservices.language.textanalytics.models.enum + :param model_version: Default value: "latest" . + :type model_version: str + :param string_index_type: Possible values include: 'TextElements_v8', + 'UnicodeCodePoint', 'Utf16CodeUnit'. Default value: "TextElements_v8" . + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'domain': {'key': 'domain', 'type': 'str'}, + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'StringIndexTypeResponse'}, + } + + def __init__(self, **kwargs): + super(PiiTaskParameters, self).__init__(**kwargs) + self.domain = kwargs.get('domain', "none") + self.model_version = kwargs.get('model_version', "latest") + self.string_index_type = kwargs.get('string_index_type', "TextElements_v8") + + +class RequestStatistics(Model): + """if showStats=true was specified in the request this field will contain + information about the request payload. + + All required parameters must be populated in order to send to Azure. + + :param documents_count: Required. Number of documents submitted in the + request. + :type documents_count: int + :param valid_documents_count: Required. Number of valid documents. This + excludes empty, over-size limit or non-supported languages documents. + :type valid_documents_count: int + :param erroneous_documents_count: Required. Number of invalid documents. + This includes empty, over-size limit or non-supported languages documents. + :type erroneous_documents_count: int + :param transactions_count: Required. Number of transactions for the + request. + :type transactions_count: long + """ + + _validation = { + 'documents_count': {'required': True}, + 'valid_documents_count': {'required': True}, + 'erroneous_documents_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _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) + + +class SentenceAspect(Model): + """SentenceAspect. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Aspect level sentiment for the aspect in the + sentence. Possible values include: 'positive', 'mixed', 'negative' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.TokenSentimentValue + :param confidence_scores: Required. Aspect level sentiment confidence + scores for the aspect in the sentence. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.AspectConfidenceScoreLabel + :param offset: Required. The aspect offset from the start of the sentence. + :type offset: int + :param length: Required. The length of the aspect. + :type length: int + :param text: Required. The aspect text detected. + :type text: str + :param relations: Required. The array of either opinion or aspect object + which is related to the aspect. + :type relations: + list[~azure.cognitiveservices.language.textanalytics.models.AspectRelation] + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'relations': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'TokenSentimentValue'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'AspectConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'relations': {'key': 'relations', 'type': '[AspectRelation]'}, + } + + def __init__(self, **kwargs): + super(SentenceAspect, self).__init__(**kwargs) + self.sentiment = kwargs.get('sentiment', None) + self.confidence_scores = kwargs.get('confidence_scores', None) + self.offset = kwargs.get('offset', None) + self.length = kwargs.get('length', None) + self.text = kwargs.get('text', None) + self.relations = kwargs.get('relations', None) + + +class SentenceOpinion(Model): + """SentenceOpinion. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Opinion level sentiment for the aspect in the + sentence. Possible values include: 'positive', 'mixed', 'negative' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.TokenSentimentValue + :param confidence_scores: Required. Opinion level sentiment confidence + scores for the aspect in the sentence. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.AspectConfidenceScoreLabel + :param offset: Required. The opinion offset from the start of the + sentence. + :type offset: int + :param length: Required. The length of the opinion. + :type length: int + :param text: Required. The aspect text detected. + :type text: str + :param is_negated: Required. The indicator representing if the opinion is + negated. + :type is_negated: bool + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'is_negated': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'TokenSentimentValue'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'AspectConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'is_negated': {'key': 'isNegated', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(SentenceOpinion, self).__init__(**kwargs) + self.sentiment = kwargs.get('sentiment', None) + self.confidence_scores = kwargs.get('confidence_scores', None) + self.offset = kwargs.get('offset', None) + self.length = kwargs.get('length', None) + self.text = kwargs.get('text', None) + self.is_negated = kwargs.get('is_negated', None) + + +class SentenceSentiment(Model): + """SentenceSentiment. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The sentence text. + :type text: str + :param sentiment: Required. The predicted Sentiment for the sentence. + Possible values include: 'positive', 'neutral', 'negative' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.SentenceSentimentValue + :param confidence_scores: Required. The sentiment confidence score between + 0 and 1 for the sentence for all classes. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.SentimentConfidenceScorePerLabel + :param offset: Required. The sentence offset from the start of the + document. + :type offset: int + :param length: Required. The length of the sentence. + :type length: int + :param aspects: The array of aspect object for the sentence. + :type aspects: + list[~azure.cognitiveservices.language.textanalytics.models.SentenceAspect] + :param opinions: The array of opinion object for the sentence. + :type opinions: + list[~azure.cognitiveservices.language.textanalytics.models.SentenceOpinion] + """ + + _validation = { + 'text': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'SentenceSentimentValue'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'aspects': {'key': 'aspects', 'type': '[SentenceAspect]'}, + 'opinions': {'key': 'opinions', 'type': '[SentenceOpinion]'}, + } + + def __init__(self, **kwargs): + super(SentenceSentiment, self).__init__(**kwargs) + self.text = kwargs.get('text', None) + self.sentiment = kwargs.get('sentiment', None) + self.confidence_scores = kwargs.get('confidence_scores', None) + self.offset = kwargs.get('offset', None) + self.length = kwargs.get('length', None) + self.aspects = kwargs.get('aspects', None) + self.opinions = kwargs.get('opinions', None) + + +class SentimentConfidenceScorePerLabel(Model): + """Represents the confidence scores between 0 and 1 across all sentiment + classes: positive, neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param neutral: Required. + :type neutral: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'neutral': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'neutral': {'key': 'neutral', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(SentimentConfidenceScorePerLabel, self).__init__(**kwargs) + self.positive = kwargs.get('positive', None) + self.neutral = kwargs.get('neutral', None) + self.negative = kwargs.get('negative', None) + + +class SentimentResponse(Model): + """SentimentResponse. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Sentiment analysis per document. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentSentiment] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentSentiment]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SentimentResponse, self).__init__(**kwargs) + self.documents = kwargs.get('documents', None) + self.errors = kwargs.get('errors', None) + self.statistics = kwargs.get('statistics', None) + self.model_version = kwargs.get('model_version', None) + + +class TasksState(Model): + """TasksState. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'AnalyzeJobStateTasks'}, + } + + def __init__(self, **kwargs): + super(TasksState, self).__init__(**kwargs) + self.tasks = kwargs.get('tasks', None) + + +class TextAnalyticsError(Model): + """TextAnalyticsError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: + 'InvalidRequest', 'InvalidArgument', 'InternalServerError', + 'ServiceUnavailable', 'NotFound' + :type code: str or + ~azure.cognitiveservices.language.textanalytics.models.ErrorCodeValue + :param message: Required. Error message. + :type message: str + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: + ~azure.cognitiveservices.language.textanalytics.models.InnerError + :param details: Details about specific errors that led to this reported + error. + :type details: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'ErrorCodeValue'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'details': {'key': 'details', 'type': '[TextAnalyticsError]'}, + } + + def __init__(self, **kwargs): + super(TextAnalyticsError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.innererror = kwargs.get('innererror', None) + self.details = kwargs.get('details', None) + + +class TextAnalyticsWarning(Model): + """TextAnalyticsWarning. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: + 'LongWordsInDocument', 'DocumentTruncated' + :type code: str or + ~azure.cognitiveservices.language.textanalytics.models.WarningCodeValue + :param message: Required. Warning message. + :type message: str + :param target_ref: A JSON pointer reference indicating the target object. + :type target_ref: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target_ref': {'key': 'targetRef', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TextAnalyticsWarning, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target_ref = kwargs.get('target_ref', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_models_py3.py new file mode 100644 index 000000000000..c76deb5f4828 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_models_py3.py @@ -0,0 +1,2157 @@ +# 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 AnalyzeBatchInput(Model): + """AnalyzeBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param display_name: Optional display name for the analysis job. + :type display_name: str + :param analysis_input: Required. + :type analysis_input: + ~azure.cognitiveservices.language.textanalytics.models.MultiLanguageBatchInput + :param tasks: Required. The set of tasks to execute on the input + documents. Cannot specify the same task more than once. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.JobManifestTasks + """ + + _validation = { + 'analysis_input': {'required': True}, + 'tasks': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'analysis_input': {'key': 'analysisInput', 'type': 'MultiLanguageBatchInput'}, + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + } + + def __init__(self, *, analysis_input, tasks, display_name: str=None, **kwargs) -> None: + super(AnalyzeBatchInput, self).__init__(**kwargs) + self.display_name = display_name + self.analysis_input = analysis_input + self.tasks = tasks + + +class AnalyzeJobState(Model): + """AnalyzeJobState. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: datetime + :param display_name: + :type display_name: str + :param expiration_date_time: + :type expiration_date_time: datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param status: Required. Possible values include: 'notStarted', 'running', + 'succeeded', 'failed', 'cancelled', 'cancelling', 'partiallyCompleted' + :type status: str or + ~azure.cognitiveservices.language.textanalytics.models.State + :param tasks: Required. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasks + :param errors: + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param next_link: + :type next_link: str + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'tasks': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'State'}, + 'tasks': {'key': 'tasks', 'type': 'AnalyzeJobStateTasks'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__(self, *, created_date_time, job_id: str, last_update_date_time, status, tasks, display_name: str=None, expiration_date_time=None, errors=None, statistics=None, next_link: str=None, **kwargs) -> None: + super(AnalyzeJobState, self).__init__(**kwargs) + self.created_date_time = created_date_time + self.display_name = display_name + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status + self.tasks = tasks + self.errors = errors + self.statistics = statistics + self.next_link = next_link + + +class AnalyzeJobStateTasks(Model): + """AnalyzeJobStateTasks. + + All required parameters must be populated in order to send to Azure. + + :param details: + :type details: + ~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksDetails + :param completed: Required. + :type completed: int + :param failed: Required. + :type failed: int + :param in_progress: Required. + :type in_progress: int + :param total: Required. + :type total: int + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksEntityRecognitionTasksItem] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksEntityRecognitionPiiTasksItem] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasksKeyPhraseExtractionTasksItem] + """ + + _validation = { + 'completed': {'required': True}, + 'failed': {'required': True}, + 'in_progress': {'required': True}, + 'total': {'required': True}, + } + + _attribute_map = { + 'details': {'key': 'details', 'type': 'AnalyzeJobStateTasksDetails'}, + 'completed': {'key': 'completed', 'type': 'int'}, + 'failed': {'key': 'failed', 'type': 'int'}, + 'in_progress': {'key': 'inProgress', 'type': 'int'}, + 'total': {'key': 'total', 'type': 'int'}, + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[AnalyzeJobStateTasksEntityRecognitionTasksItem]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[AnalyzeJobStateTasksEntityRecognitionPiiTasksItem]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[AnalyzeJobStateTasksKeyPhraseExtractionTasksItem]'}, + } + + def __init__(self, *, completed: int, failed: int, in_progress: int, total: int, details=None, entity_recognition_tasks=None, entity_recognition_pii_tasks=None, key_phrase_extraction_tasks=None, **kwargs) -> None: + super(AnalyzeJobStateTasks, self).__init__(**kwargs) + self.details = details + self.completed = completed + self.failed = failed + self.in_progress = in_progress + self.total = total + self.entity_recognition_tasks = entity_recognition_tasks + self.entity_recognition_pii_tasks = entity_recognition_pii_tasks + self.key_phrase_extraction_tasks = key_phrase_extraction_tasks + + +class TaskState(Model): + """TaskState. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + } + + def __init__(self, *, last_update_date_time, status, name: str=None, **kwargs) -> None: + super(TaskState, self).__init__(**kwargs) + self.last_update_date_time = last_update_date_time + self.name = name + self.status = status + + +class AnalyzeJobStateTasksDetails(TaskState): + """AnalyzeJobStateTasksDetails. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + } + + def __init__(self, *, last_update_date_time, status, name: str=None, **kwargs) -> None: + super(AnalyzeJobStateTasksDetails, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, **kwargs) + + +class AnalyzeJobStateTasksEntityRecognitionPiiTasksItem(TaskState): + """AnalyzeJobStateTasksEntityRecognitionPiiTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + :param results: Required. + :type results: + ~azure.cognitiveservices.language.textanalytics.models.PiiResult + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'results': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + 'results': {'key': 'results', 'type': 'PiiResult'}, + } + + def __init__(self, *, last_update_date_time, status, results, name: str=None, **kwargs) -> None: + super(AnalyzeJobStateTasksEntityRecognitionPiiTasksItem, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, **kwargs) + self.results = results + + +class AnalyzeJobStateTasksEntityRecognitionTasksItem(TaskState): + """AnalyzeJobStateTasksEntityRecognitionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + :param results: Required. + :type results: + ~azure.cognitiveservices.language.textanalytics.models.EntitiesResult + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'results': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + 'results': {'key': 'results', 'type': 'EntitiesResult'}, + } + + def __init__(self, *, last_update_date_time, status, results, name: str=None, **kwargs) -> None: + super(AnalyzeJobStateTasksEntityRecognitionTasksItem, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, **kwargs) + self.results = results + + +class AnalyzeJobStateTasksKeyPhraseExtractionTasksItem(TaskState): + """AnalyzeJobStateTasksKeyPhraseExtractionTasksItem. + + All required parameters must be populated in order to send to Azure. + + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param name: + :type name: str + :param status: Required. + :type status: object + :param results: Required. + :type results: + ~azure.cognitiveservices.language.textanalytics.models.KeyPhraseResult + """ + + _validation = { + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + 'results': {'required': True}, + } + + _attribute_map = { + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'object'}, + 'results': {'key': 'results', 'type': 'KeyPhraseResult'}, + } + + def __init__(self, *, last_update_date_time, status, results, name: str=None, **kwargs) -> None: + super(AnalyzeJobStateTasksKeyPhraseExtractionTasksItem, self).__init__(last_update_date_time=last_update_date_time, name=name, status=status, **kwargs) + self.results = results + + +class AspectConfidenceScoreLabel(Model): + """Represents the confidence scores across all sentiment classes: positive, + neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__(self, *, positive: float, negative: float, **kwargs) -> None: + super(AspectConfidenceScoreLabel, self).__init__(**kwargs) + self.positive = positive + self.negative = negative + + +class AspectRelation(Model): + """AspectRelation. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. The type related to the aspect. Possible + values include: 'opinion', 'aspect' + :type relation_type: str or + ~azure.cognitiveservices.language.textanalytics.models.AspectRelationType + :param ref: Required. The JSON pointer indicating the linked object. + :type ref: str + """ + + _validation = { + 'relation_type': {'required': True}, + 'ref': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'AspectRelationType'}, + 'ref': {'key': 'ref', 'type': 'str'}, + } + + def __init__(self, *, relation_type, ref: str, **kwargs) -> None: + super(AspectRelation, self).__init__(**kwargs) + self.relation_type = relation_type + self.ref = ref + + +class DetectedLanguage(Model): + """DetectedLanguage. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Long name of a detected language (e.g. English, + French). + :type name: str + :param iso6391_name: Required. A two letter representation of the detected + language according to the ISO 639-1 standard (e.g. en, fr). + :type iso6391_name: str + :param confidence_score: Required. A confidence score between 0 and 1. + Scores close to 1 indicate 100% certainty that the identified language is + true. + :type confidence_score: float + """ + + _validation = { + 'name': {'required': True}, + 'iso6391_name': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'iso6391_name': {'key': 'iso6391Name', 'type': 'str'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__(self, *, name: str, iso6391_name: str, confidence_score: float, **kwargs) -> None: + super(DetectedLanguage, self).__init__(**kwargs) + self.name = name + self.iso6391_name = iso6391_name + self.confidence_score = confidence_score + + +class DocumentEntities(Model): + """DocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized entities in the document. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str, entities, warnings, statistics=None, **kwargs) -> None: + super(DocumentEntities, self).__init__(**kwargs) + self.id = id + self.entities = entities + self.warnings = warnings + self.statistics = statistics + + +class DocumentError(Model): + """DocumentError. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Document Id. + :type id: str + :param error: Required. Document Error. + :type error: + ~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError + """ + + _validation = { + 'id': {'required': True}, + 'error': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__(self, *, id: str, error, **kwargs) -> None: + super(DocumentError, self).__init__(**kwargs) + self.id = id + self.error = error + + +class DocumentHealthcareEntities(Model): + """DocumentHealthcareEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Healthcare entities. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.HealthcareEntity] + :param relations: Required. Healthcare entity relations. + :type relations: + list[~azure.cognitiveservices.language.textanalytics.models.HealthcareRelation] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'entities': {'required': True}, + 'relations': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[HealthcareEntity]'}, + 'relations': {'key': 'relations', 'type': '[HealthcareRelation]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str, entities, relations, warnings, statistics=None, **kwargs) -> None: + super(DocumentHealthcareEntities, self).__init__(**kwargs) + self.id = id + self.entities = entities + self.relations = relations + self.warnings = warnings + self.statistics = statistics + + +class DocumentKeyPhrases(Model): + """DocumentKeyPhrases. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param key_phrases: Required. A list of representative words or phrases. + The number of key phrases returned is proportional to the number of words + in the input document. + :type key_phrases: list[str] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'key_phrases': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'key_phrases': {'key': 'keyPhrases', 'type': '[str]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str, key_phrases, warnings, statistics=None, **kwargs) -> None: + super(DocumentKeyPhrases, self).__init__(**kwargs) + self.id = id + self.key_phrases = key_phrases + self.warnings = warnings + self.statistics = statistics + + +class DocumentLanguage(Model): + """DocumentLanguage. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param detected_language: Required. Detected Language. + :type detected_language: + ~azure.cognitiveservices.language.textanalytics.models.DetectedLanguage + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'detected_language': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'detected_language': {'key': 'detectedLanguage', 'type': 'DetectedLanguage'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str, detected_language, warnings, statistics=None, **kwargs) -> None: + super(DocumentLanguage, self).__init__(**kwargs) + self.id = id + self.detected_language = detected_language + self.warnings = warnings + self.statistics = statistics + + +class DocumentLinkedEntities(Model): + """DocumentLinkedEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param entities: Required. Recognized well-known entities in the document. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.LinkedEntity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[LinkedEntity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str, entities, warnings, statistics=None, **kwargs) -> None: + super(DocumentLinkedEntities, self).__init__(**kwargs) + self.id = id + self.entities = entities + self.warnings = warnings + self.statistics = statistics + + +class DocumentSentiment(Model): + """DocumentSentiment. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param sentiment: Required. Predicted sentiment for document (Negative, + Neutral, Positive, or Mixed). Possible values include: 'positive', + 'neutral', 'negative', 'mixed' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.DocumentSentimentValue + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.DocumentStatistics + :param confidence_scores: Required. Document level sentiment confidence + scores between 0 and 1 for each sentiment class. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.SentimentConfidenceScorePerLabel + :param sentences: Required. Sentence level sentiment analysis. + :type sentences: + list[~azure.cognitiveservices.language.textanalytics.models.SentenceSentiment] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + """ + + _validation = { + 'id': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'sentences': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'DocumentSentimentValue'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'sentences': {'key': 'sentences', 'type': '[SentenceSentiment]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + } + + def __init__(self, *, id: str, sentiment, confidence_scores, sentences, warnings, statistics=None, **kwargs) -> None: + super(DocumentSentiment, self).__init__(**kwargs) + self.id = id + self.sentiment = sentiment + self.statistics = statistics + self.confidence_scores = confidence_scores + self.sentences = sentences + self.warnings = warnings + + +class DocumentStatistics(Model): + """if showStats=true was specified in the request this field will contain + information about the document payload. + + All required parameters must be populated in order to send to Azure. + + :param characters_count: Required. Number of text elements recognized in + the document. + :type characters_count: int + :param transactions_count: Required. Number of transactions for the + document. + :type transactions_count: int + """ + + _validation = { + 'characters_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _attribute_map = { + 'characters_count': {'key': 'charactersCount', 'type': 'int'}, + 'transactions_count': {'key': 'transactionsCount', 'type': 'int'}, + } + + def __init__(self, *, characters_count: int, transactions_count: int, **kwargs) -> None: + super(DocumentStatistics, self).__init__(**kwargs) + self.characters_count = characters_count + self.transactions_count = transactions_count + + +class EntitiesResult(Model): + """EntitiesResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, *, documents, errors, model_version: str, statistics=None, **kwargs) -> None: + super(EntitiesResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class EntitiesTask(Model): + """EntitiesTask. + + :param parameters: + :type parameters: + ~azure.cognitiveservices.language.textanalytics.models.EntitiesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'EntitiesTaskParameters'}, + } + + def __init__(self, *, parameters=None, **kwargs) -> None: + super(EntitiesTask, self).__init__(**kwargs) + self.parameters = parameters + + +class EntitiesTaskParameters(Model): + """EntitiesTaskParameters. + + :param model_version: Default value: "latest" . + :type model_version: str + :param string_index_type: Possible values include: 'TextElements_v8', + 'UnicodeCodePoint', 'Utf16CodeUnit'. Default value: "TextElements_v8" . + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'StringIndexTypeResponse'}, + } + + def __init__(self, *, model_version: str="latest", string_index_type="TextElements_v8", **kwargs) -> None: + super(EntitiesTaskParameters, self).__init__(**kwargs) + self.model_version = model_version + self.string_index_type = string_index_type + + +class Entity(Model): + """Entity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of + different 'stringIndexType' values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different + 'stringIndexType' values can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the + extracted entity. + :type confidence_score: float + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + } + + def __init__(self, *, text: str, category: str, offset: int, length: int, confidence_score: float, subcategory: str=None, **kwargs) -> None: + super(Entity, self).__init__(**kwargs) + self.text = text + self.category = category + self.subcategory = subcategory + self.offset = offset + self.length = length + self.confidence_score = confidence_score + + +class EntityLinkingResult(Model): + """EntityLinkingResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentLinkedEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLinkedEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, *, documents, errors, model_version: str, statistics=None, **kwargs) -> None: + super(EntityLinkingResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class ErrorResponse(Model): + """ErrorResponse. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. Document Error. + :type error: + ~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'TextAnalyticsError'}, + } + + def __init__(self, *, error, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class HealthcareEntity(Entity): + """HealthcareEntity. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. Entity text as appears in the request. + :type text: str + :param category: Required. Entity type. + :type category: str + :param subcategory: (Optional) Entity sub type. + :type subcategory: str + :param offset: Required. Start position for the entity text. Use of + different 'stringIndexType' values can affect the offset returned. + :type offset: int + :param length: Required. Length for the entity text. Use of different + 'stringIndexType' values can affect the length returned. + :type length: int + :param confidence_score: Required. Confidence score between 0 and 1 of the + extracted entity. + :type confidence_score: float + :param is_negated: Required. + :type is_negated: bool + :param links: Entity references in known data sources. + :type links: + list[~azure.cognitiveservices.language.textanalytics.models.HealthcareEntityLink] + """ + + _validation = { + 'text': {'required': True}, + 'category': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'confidence_score': {'required': True}, + 'is_negated': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'subcategory': {'key': 'subcategory', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'is_negated': {'key': 'isNegated', 'type': 'bool'}, + 'links': {'key': 'links', 'type': '[HealthcareEntityLink]'}, + } + + def __init__(self, *, text: str, category: str, offset: int, length: int, confidence_score: float, is_negated: bool, subcategory: str=None, links=None, **kwargs) -> None: + super(HealthcareEntity, self).__init__(text=text, category=category, subcategory=subcategory, offset=offset, length=length, confidence_score=confidence_score, **kwargs) + self.is_negated = is_negated + self.links = links + + +class HealthcareEntityLink(Model): + """HealthcareEntityLink. + + All required parameters must be populated in order to send to Azure. + + :param data_source: Required. Entity Catalog. Examples include: UMLS, CHV, + MSH, etc. + :type data_source: str + :param id: Required. Entity id in the given source catalog. + :type id: str + """ + + _validation = { + 'data_source': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, data_source: str, id: str, **kwargs) -> None: + super(HealthcareEntityLink, self).__init__(**kwargs) + self.data_source = data_source + self.id = id + + +class HealthcareJobState(Model): + """HealthcareJobState. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: datetime + :param display_name: + :type display_name: str + :param expiration_date_time: + :type expiration_date_time: datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param status: Required. Possible values include: 'notStarted', 'running', + 'succeeded', 'failed', 'cancelled', 'cancelling', 'partiallyCompleted' + :type status: str or + ~azure.cognitiveservices.language.textanalytics.models.State + :param results: + :type results: + ~azure.cognitiveservices.language.textanalytics.models.HealthcareResult + :param errors: + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError] + :param next_link: + :type next_link: str + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'State'}, + 'results': {'key': 'results', 'type': 'HealthcareResult'}, + 'errors': {'key': 'errors', 'type': '[TextAnalyticsError]'}, + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__(self, *, created_date_time, job_id: str, last_update_date_time, status, display_name: str=None, expiration_date_time=None, results=None, errors=None, next_link: str=None, **kwargs) -> None: + super(HealthcareJobState, self).__init__(**kwargs) + self.created_date_time = created_date_time + self.display_name = display_name + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status + self.results = results + self.errors = errors + self.next_link = next_link + + +class HealthcareRelation(Model): + """HealthcareRelation. + + All required parameters must be populated in order to send to Azure. + + :param relation_type: Required. Type of relation. Examples include: + `DosageOfMedication` or 'FrequencyOfMedication', etc. + :type relation_type: str + :param bidirectional: Required. If true the relation between the entities + is bidirectional, otherwise directionality is source to target. + :type bidirectional: bool + :param source: Required. Reference link to the source entity. + :type source: str + :param target: Required. Reference link to the target entity. + :type target: str + """ + + _validation = { + 'relation_type': {'required': True}, + 'bidirectional': {'required': True}, + 'source': {'required': True}, + 'target': {'required': True}, + } + + _attribute_map = { + 'relation_type': {'key': 'relationType', 'type': 'str'}, + 'bidirectional': {'key': 'bidirectional', 'type': 'bool'}, + 'source': {'key': 'source', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__(self, *, relation_type: str, bidirectional: bool, source: str, target: str, **kwargs) -> None: + super(HealthcareRelation, self).__init__(**kwargs) + self.relation_type = relation_type + self.bidirectional = bidirectional + self.source = source + self.target = target + + +class HealthcareResult(Model): + """HealthcareResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentHealthcareEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentHealthcareEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, *, documents, errors, model_version: str, statistics=None, **kwargs) -> None: + super(HealthcareResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class InnerError(Model): + """InnerError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: + 'InvalidParameterValue', 'InvalidRequestBodyFormat', 'EmptyRequest', + 'MissingInputRecords', 'InvalidDocument', 'ModelVersionIncorrect', + 'InvalidDocumentBatch', 'UnsupportedLanguageCode', 'InvalidCountryHint' + :type code: str or + ~azure.cognitiveservices.language.textanalytics.models.InnerErrorCodeValue + :param message: Required. Error message. + :type message: str + :param details: Error details. + :type details: dict[str, str] + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: + ~azure.cognitiveservices.language.textanalytics.models.InnerError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '{str}'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + } + + def __init__(self, *, code, message: str, details=None, target: str=None, innererror=None, **kwargs) -> None: + super(InnerError, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + self.target = target + self.innererror = innererror + + +class JobDescriptor(Model): + """JobDescriptor. + + :param display_name: Optional display name for the analysis job. + :type display_name: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, **kwargs) -> None: + super(JobDescriptor, self).__init__(**kwargs) + self.display_name = display_name + + +class JobManifest(Model): + """JobManifest. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. The set of tasks to execute on the input + documents. Cannot specify the same task more than once. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.JobManifestTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'JobManifestTasks'}, + } + + def __init__(self, *, tasks, **kwargs) -> None: + super(JobManifest, self).__init__(**kwargs) + self.tasks = tasks + + +class JobManifestTasks(Model): + """The set of tasks to execute on the input documents. Cannot specify the same + task more than once. + + :param entity_recognition_tasks: + :type entity_recognition_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.EntitiesTask] + :param entity_recognition_pii_tasks: + :type entity_recognition_pii_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.PiiTask] + :param key_phrase_extraction_tasks: + :type key_phrase_extraction_tasks: + list[~azure.cognitiveservices.language.textanalytics.models.KeyPhrasesTask] + """ + + _attribute_map = { + 'entity_recognition_tasks': {'key': 'entityRecognitionTasks', 'type': '[EntitiesTask]'}, + 'entity_recognition_pii_tasks': {'key': 'entityRecognitionPiiTasks', 'type': '[PiiTask]'}, + 'key_phrase_extraction_tasks': {'key': 'keyPhraseExtractionTasks', 'type': '[KeyPhrasesTask]'}, + } + + def __init__(self, *, entity_recognition_tasks=None, entity_recognition_pii_tasks=None, key_phrase_extraction_tasks=None, **kwargs) -> None: + super(JobManifestTasks, self).__init__(**kwargs) + self.entity_recognition_tasks = entity_recognition_tasks + self.entity_recognition_pii_tasks = entity_recognition_pii_tasks + self.key_phrase_extraction_tasks = key_phrase_extraction_tasks + + +class JobMetadata(Model): + """JobMetadata. + + All required parameters must be populated in order to send to Azure. + + :param created_date_time: Required. + :type created_date_time: datetime + :param display_name: + :type display_name: str + :param expiration_date_time: + :type expiration_date_time: datetime + :param job_id: Required. + :type job_id: str + :param last_update_date_time: Required. + :type last_update_date_time: datetime + :param status: Required. Possible values include: 'notStarted', 'running', + 'succeeded', 'failed', 'cancelled', 'cancelling', 'partiallyCompleted' + :type status: str or + ~azure.cognitiveservices.language.textanalytics.models.State + """ + + _validation = { + 'created_date_time': {'required': True}, + 'job_id': {'required': True}, + 'last_update_date_time': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'expiration_date_time': {'key': 'expirationDateTime', 'type': 'iso-8601'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'last_update_date_time': {'key': 'lastUpdateDateTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'State'}, + } + + def __init__(self, *, created_date_time, job_id: str, last_update_date_time, status, display_name: str=None, expiration_date_time=None, **kwargs) -> None: + super(JobMetadata, self).__init__(**kwargs) + self.created_date_time = created_date_time + self.display_name = display_name + self.expiration_date_time = expiration_date_time + self.job_id = job_id + self.last_update_date_time = last_update_date_time + self.status = status + + +class KeyPhraseResult(Model): + """KeyPhraseResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentKeyPhrases] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentKeyPhrases]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, *, documents, errors, model_version: str, statistics=None, **kwargs) -> None: + super(KeyPhraseResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class KeyPhrasesTask(Model): + """KeyPhrasesTask. + + :param parameters: + :type parameters: + ~azure.cognitiveservices.language.textanalytics.models.KeyPhrasesTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'KeyPhrasesTaskParameters'}, + } + + def __init__(self, *, parameters=None, **kwargs) -> None: + super(KeyPhrasesTask, self).__init__(**kwargs) + self.parameters = parameters + + +class KeyPhrasesTaskParameters(Model): + """KeyPhrasesTaskParameters. + + :param model_version: Default value: "latest" . + :type model_version: str + """ + + _attribute_map = { + 'model_version': {'key': 'model-version', 'type': 'str'}, + } + + def __init__(self, *, model_version: str="latest", **kwargs) -> None: + super(KeyPhrasesTaskParameters, self).__init__(**kwargs) + self.model_version = model_version + + +class LanguageBatchInput(Model): + """LanguageBatchInput. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.LanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[LanguageInput]'}, + } + + def __init__(self, *, documents, **kwargs) -> None: + super(LanguageBatchInput, self).__init__(**kwargs) + self.documents = documents + + +class LanguageInput(Model): + """LanguageInput. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param text: Required. + :type text: str + :param country_hint: + :type country_hint: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'country_hint': {'key': 'countryHint', 'type': 'str'}, + } + + def __init__(self, *, id: str, text: str, country_hint: str=None, **kwargs) -> None: + super(LanguageInput, self).__init__(**kwargs) + self.id = id + self.text = text + self.country_hint = country_hint + + +class LanguageResult(Model): + """LanguageResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentLanguage] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentLanguage]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, *, documents, errors, model_version: str, statistics=None, **kwargs) -> None: + super(LanguageResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class LinkedEntity(Model): + """LinkedEntity. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Entity Linking formal name. + :type name: str + :param matches: Required. List of instances this entity appears in the + text. + :type matches: + list[~azure.cognitiveservices.language.textanalytics.models.Match] + :param language: Required. Language used in the data source. + :type language: str + :param id: Unique identifier of the recognized entity from the data + source. + :type id: str + :param url: Required. URL for the entity's page from the data source. + :type url: str + :param data_source: Required. Data source used to extract entity linking, + such as Wiki/Bing etc. + :type data_source: str + :param bing_id: Bing Entity Search API unique identifier of the recognized + entity. + :type bing_id: str + """ + + _validation = { + 'name': {'required': True}, + 'matches': {'required': True}, + 'language': {'required': True}, + 'url': {'required': True}, + 'data_source': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'matches': {'key': 'matches', 'type': '[Match]'}, + 'language': {'key': 'language', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'data_source': {'key': 'dataSource', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + } + + def __init__(self, *, name: str, matches, language: str, url: str, data_source: str, id: str=None, bing_id: str=None, **kwargs) -> None: + super(LinkedEntity, self).__init__(**kwargs) + self.name = name + self.matches = matches + self.language = language + self.id = id + self.url = url + self.data_source = data_source + self.bing_id = bing_id + + +class Match(Model): + """Match. + + All required parameters must be populated in order to send to Azure. + + :param confidence_score: Required. If a well-known item is recognized, a + decimal number denoting the confidence level between 0 and 1 will be + returned. + :type confidence_score: float + :param text: Required. Entity text as appears in the request. + :type text: str + :param offset: Required. Start position for the entity match text. + :type offset: int + :param length: Required. Length for the entity match text. + :type length: int + """ + + _validation = { + 'confidence_score': {'required': True}, + 'text': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'confidence_score': {'key': 'confidenceScore', 'type': 'float'}, + 'text': {'key': 'text', 'type': 'str'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + } + + def __init__(self, *, confidence_score: float, text: str, offset: int, length: int, **kwargs) -> None: + super(Match, self).__init__(**kwargs) + self.confidence_score = confidence_score + self.text = text + self.offset = offset + self.length = length + + +class MultiLanguageBatchInput(Model): + """Contains a set of input documents to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. The set of documents to process as part of + this batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + """ + + _validation = { + 'documents': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[MultiLanguageInput]'}, + } + + def __init__(self, *, documents, **kwargs) -> None: + super(MultiLanguageBatchInput, self).__init__(**kwargs) + self.documents = documents + + +class MultiLanguageInput(Model): + """Contains an input document to be analyzed by the service. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A unique, non-empty document identifier. + :type id: str + :param text: Required. The input text to process. + :type text: str + :param language: (Optional) This is the 2 letter ISO 639-1 representation + of a language. For example, use "en" for English; "es" for Spanish etc. If + not set, use "en" for English as default. + :type language: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, *, id: str, text: str, language: str=None, **kwargs) -> None: + super(MultiLanguageInput, self).__init__(**kwargs) + self.id = id + self.text = text + self.language = language + + +class Pagination(Model): + """Pagination. + + :param next_link: + :type next_link: str + """ + + _attribute_map = { + 'next_link': {'key': '@nextLink', 'type': 'str'}, + } + + def __init__(self, *, next_link: str=None, **kwargs) -> None: + super(Pagination, self).__init__(**kwargs) + self.next_link = next_link + + +class PiiDocumentEntities(Model): + """PiiDocumentEntities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique, non-empty document identifier. + :type id: str + :param redacted_text: Required. Returns redacted text. + :type redacted_text: str + :param entities: Required. Recognized entities in the document. + :type entities: + list[~azure.cognitiveservices.language.textanalytics.models.Entity] + :param warnings: Required. Warnings encountered while processing document. + :type warnings: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsWarning] + :param statistics: 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': {'required': True}, + 'redacted_text': {'required': True}, + 'entities': {'required': True}, + 'warnings': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'redacted_text': {'key': 'redactedText', 'type': 'str'}, + 'entities': {'key': 'entities', 'type': '[Entity]'}, + 'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'}, + 'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'}, + } + + def __init__(self, *, id: str, redacted_text: str, entities, warnings, statistics=None, **kwargs) -> None: + super(PiiDocumentEntities, self).__init__(**kwargs) + self.id = id + self.redacted_text = redacted_text + self.entities = entities + self.warnings = warnings + self.statistics = statistics + + +class PiiResult(Model): + """PiiResult. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Response by document + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.PiiDocumentEntities] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[PiiDocumentEntities]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, *, documents, errors, model_version: str, statistics=None, **kwargs) -> None: + super(PiiResult, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class PiiTask(Model): + """PiiTask. + + :param parameters: + :type parameters: + ~azure.cognitiveservices.language.textanalytics.models.PiiTaskParameters + """ + + _attribute_map = { + 'parameters': {'key': 'parameters', 'type': 'PiiTaskParameters'}, + } + + def __init__(self, *, parameters=None, **kwargs) -> None: + super(PiiTask, self).__init__(**kwargs) + self.parameters = parameters + + +class PiiTaskParameters(Model): + """PiiTaskParameters. + + :param domain: Possible values include: 'phi', 'none'. Default value: + "none" . + :type domain: str or + ~azure.cognitiveservices.language.textanalytics.models.enum + :param model_version: Default value: "latest" . + :type model_version: str + :param string_index_type: Possible values include: 'TextElements_v8', + 'UnicodeCodePoint', 'Utf16CodeUnit'. Default value: "TextElements_v8" . + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexTypeResponse + """ + + _attribute_map = { + 'domain': {'key': 'domain', 'type': 'str'}, + 'model_version': {'key': 'model-version', 'type': 'str'}, + 'string_index_type': {'key': 'stringIndexType', 'type': 'StringIndexTypeResponse'}, + } + + def __init__(self, *, domain="none", model_version: str="latest", string_index_type="TextElements_v8", **kwargs) -> None: + super(PiiTaskParameters, self).__init__(**kwargs) + self.domain = domain + self.model_version = model_version + self.string_index_type = string_index_type + + +class RequestStatistics(Model): + """if showStats=true was specified in the request this field will contain + information about the request payload. + + All required parameters must be populated in order to send to Azure. + + :param documents_count: Required. Number of documents submitted in the + request. + :type documents_count: int + :param valid_documents_count: Required. Number of valid documents. This + excludes empty, over-size limit or non-supported languages documents. + :type valid_documents_count: int + :param erroneous_documents_count: Required. Number of invalid documents. + This includes empty, over-size limit or non-supported languages documents. + :type erroneous_documents_count: int + :param transactions_count: Required. Number of transactions for the + request. + :type transactions_count: long + """ + + _validation = { + 'documents_count': {'required': True}, + 'valid_documents_count': {'required': True}, + 'erroneous_documents_count': {'required': True}, + 'transactions_count': {'required': True}, + } + + _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, valid_documents_count: int, erroneous_documents_count: int, transactions_count: int, **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 + + +class SentenceAspect(Model): + """SentenceAspect. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Aspect level sentiment for the aspect in the + sentence. Possible values include: 'positive', 'mixed', 'negative' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.TokenSentimentValue + :param confidence_scores: Required. Aspect level sentiment confidence + scores for the aspect in the sentence. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.AspectConfidenceScoreLabel + :param offset: Required. The aspect offset from the start of the sentence. + :type offset: int + :param length: Required. The length of the aspect. + :type length: int + :param text: Required. The aspect text detected. + :type text: str + :param relations: Required. The array of either opinion or aspect object + which is related to the aspect. + :type relations: + list[~azure.cognitiveservices.language.textanalytics.models.AspectRelation] + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'relations': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'TokenSentimentValue'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'AspectConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'relations': {'key': 'relations', 'type': '[AspectRelation]'}, + } + + def __init__(self, *, sentiment, confidence_scores, offset: int, length: int, text: str, relations, **kwargs) -> None: + super(SentenceAspect, self).__init__(**kwargs) + self.sentiment = sentiment + self.confidence_scores = confidence_scores + self.offset = offset + self.length = length + self.text = text + self.relations = relations + + +class SentenceOpinion(Model): + """SentenceOpinion. + + All required parameters must be populated in order to send to Azure. + + :param sentiment: Required. Opinion level sentiment for the aspect in the + sentence. Possible values include: 'positive', 'mixed', 'negative' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.TokenSentimentValue + :param confidence_scores: Required. Opinion level sentiment confidence + scores for the aspect in the sentence. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.AspectConfidenceScoreLabel + :param offset: Required. The opinion offset from the start of the + sentence. + :type offset: int + :param length: Required. The length of the opinion. + :type length: int + :param text: Required. The aspect text detected. + :type text: str + :param is_negated: Required. The indicator representing if the opinion is + negated. + :type is_negated: bool + """ + + _validation = { + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + 'text': {'required': True}, + 'is_negated': {'required': True}, + } + + _attribute_map = { + 'sentiment': {'key': 'sentiment', 'type': 'TokenSentimentValue'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'AspectConfidenceScoreLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'is_negated': {'key': 'isNegated', 'type': 'bool'}, + } + + def __init__(self, *, sentiment, confidence_scores, offset: int, length: int, text: str, is_negated: bool, **kwargs) -> None: + super(SentenceOpinion, self).__init__(**kwargs) + self.sentiment = sentiment + self.confidence_scores = confidence_scores + self.offset = offset + self.length = length + self.text = text + self.is_negated = is_negated + + +class SentenceSentiment(Model): + """SentenceSentiment. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The sentence text. + :type text: str + :param sentiment: Required. The predicted Sentiment for the sentence. + Possible values include: 'positive', 'neutral', 'negative' + :type sentiment: str or + ~azure.cognitiveservices.language.textanalytics.models.SentenceSentimentValue + :param confidence_scores: Required. The sentiment confidence score between + 0 and 1 for the sentence for all classes. + :type confidence_scores: + ~azure.cognitiveservices.language.textanalytics.models.SentimentConfidenceScorePerLabel + :param offset: Required. The sentence offset from the start of the + document. + :type offset: int + :param length: Required. The length of the sentence. + :type length: int + :param aspects: The array of aspect object for the sentence. + :type aspects: + list[~azure.cognitiveservices.language.textanalytics.models.SentenceAspect] + :param opinions: The array of opinion object for the sentence. + :type opinions: + list[~azure.cognitiveservices.language.textanalytics.models.SentenceOpinion] + """ + + _validation = { + 'text': {'required': True}, + 'sentiment': {'required': True}, + 'confidence_scores': {'required': True}, + 'offset': {'required': True}, + 'length': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'sentiment': {'key': 'sentiment', 'type': 'SentenceSentimentValue'}, + 'confidence_scores': {'key': 'confidenceScores', 'type': 'SentimentConfidenceScorePerLabel'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'length': {'key': 'length', 'type': 'int'}, + 'aspects': {'key': 'aspects', 'type': '[SentenceAspect]'}, + 'opinions': {'key': 'opinions', 'type': '[SentenceOpinion]'}, + } + + def __init__(self, *, text: str, sentiment, confidence_scores, offset: int, length: int, aspects=None, opinions=None, **kwargs) -> None: + super(SentenceSentiment, self).__init__(**kwargs) + self.text = text + self.sentiment = sentiment + self.confidence_scores = confidence_scores + self.offset = offset + self.length = length + self.aspects = aspects + self.opinions = opinions + + +class SentimentConfidenceScorePerLabel(Model): + """Represents the confidence scores between 0 and 1 across all sentiment + classes: positive, neutral, negative. + + All required parameters must be populated in order to send to Azure. + + :param positive: Required. + :type positive: float + :param neutral: Required. + :type neutral: float + :param negative: Required. + :type negative: float + """ + + _validation = { + 'positive': {'required': True}, + 'neutral': {'required': True}, + 'negative': {'required': True}, + } + + _attribute_map = { + 'positive': {'key': 'positive', 'type': 'float'}, + 'neutral': {'key': 'neutral', 'type': 'float'}, + 'negative': {'key': 'negative', 'type': 'float'}, + } + + def __init__(self, *, positive: float, neutral: float, negative: float, **kwargs) -> None: + super(SentimentConfidenceScorePerLabel, self).__init__(**kwargs) + self.positive = positive + self.neutral = neutral + self.negative = negative + + +class SentimentResponse(Model): + """SentimentResponse. + + All required parameters must be populated in order to send to Azure. + + :param documents: Required. Sentiment analysis per document. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentSentiment] + :param errors: Required. Errors by document id. + :type errors: + list[~azure.cognitiveservices.language.textanalytics.models.DocumentError] + :param statistics: + :type statistics: + ~azure.cognitiveservices.language.textanalytics.models.RequestStatistics + :param model_version: Required. This field indicates which model is used + for scoring. + :type model_version: str + """ + + _validation = { + 'documents': {'required': True}, + 'errors': {'required': True}, + 'model_version': {'required': True}, + } + + _attribute_map = { + 'documents': {'key': 'documents', 'type': '[DocumentSentiment]'}, + 'errors': {'key': 'errors', 'type': '[DocumentError]'}, + 'statistics': {'key': 'statistics', 'type': 'RequestStatistics'}, + 'model_version': {'key': 'modelVersion', 'type': 'str'}, + } + + def __init__(self, *, documents, errors, model_version: str, statistics=None, **kwargs) -> None: + super(SentimentResponse, self).__init__(**kwargs) + self.documents = documents + self.errors = errors + self.statistics = statistics + self.model_version = model_version + + +class TasksState(Model): + """TasksState. + + All required parameters must be populated in order to send to Azure. + + :param tasks: Required. + :type tasks: + ~azure.cognitiveservices.language.textanalytics.models.AnalyzeJobStateTasks + """ + + _validation = { + 'tasks': {'required': True}, + } + + _attribute_map = { + 'tasks': {'key': 'tasks', 'type': 'AnalyzeJobStateTasks'}, + } + + def __init__(self, *, tasks, **kwargs) -> None: + super(TasksState, self).__init__(**kwargs) + self.tasks = tasks + + +class TextAnalyticsError(Model): + """TextAnalyticsError. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: + 'InvalidRequest', 'InvalidArgument', 'InternalServerError', + 'ServiceUnavailable', 'NotFound' + :type code: str or + ~azure.cognitiveservices.language.textanalytics.models.ErrorCodeValue + :param message: Required. Error message. + :type message: str + :param target: Error target. + :type target: str + :param innererror: Inner error contains more specific information. + :type innererror: + ~azure.cognitiveservices.language.textanalytics.models.InnerError + :param details: Details about specific errors that led to this reported + error. + :type details: + list[~azure.cognitiveservices.language.textanalytics.models.TextAnalyticsError] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'ErrorCodeValue'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'details': {'key': 'details', 'type': '[TextAnalyticsError]'}, + } + + def __init__(self, *, code, message: str, target: str=None, innererror=None, details=None, **kwargs) -> None: + super(TextAnalyticsError, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.innererror = innererror + self.details = details + + +class TextAnalyticsWarning(Model): + """TextAnalyticsWarning. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. Possible values include: + 'LongWordsInDocument', 'DocumentTruncated' + :type code: str or + ~azure.cognitiveservices.language.textanalytics.models.WarningCodeValue + :param message: Required. Warning message. + :type message: str + :param target_ref: A JSON pointer reference indicating the target object. + :type target_ref: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target_ref': {'key': 'targetRef', 'type': 'str'}, + } + + def __init__(self, *, code, message: str, target_ref: str=None, **kwargs) -> None: + super(TextAnalyticsWarning, self).__init__(**kwargs) + self.code = code + self.message = message + self.target_ref = target_ref diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_text_analytics_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_text_analytics_client_enums.py new file mode 100644 index 000000000000..d0070590a15d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/models/_text_analytics_client_enums.py @@ -0,0 +1,93 @@ +# 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 StringIndexTypeResponse(str, Enum): + + text_elements_v8 = "TextElements_v8" #: Returned offset and length values will correspond to TextElements (Graphemes and Grapheme clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is written in .Net Framework or .Net Core and you will be using StringInfo. + unicode_code_point = "UnicodeCodePoint" #: Returned offset and length values will correspond to Unicode code points. Use this option if your application is written in a language that support Unicode, for example Python. + utf16_code_unit = "Utf16CodeUnit" #: Returned offset and length values will correspond to UTF-16 code units. Use this option if your application is written in a language that support Unicode, for example Java, JavaScript. + + +class ErrorCodeValue(str, Enum): + + invalid_request = "InvalidRequest" + invalid_argument = "InvalidArgument" + internal_server_error = "InternalServerError" + service_unavailable = "ServiceUnavailable" + not_found = "NotFound" + + +class InnerErrorCodeValue(str, Enum): + + invalid_parameter_value = "InvalidParameterValue" + invalid_request_body_format = "InvalidRequestBodyFormat" + empty_request = "EmptyRequest" + missing_input_records = "MissingInputRecords" + invalid_document = "InvalidDocument" + model_version_incorrect = "ModelVersionIncorrect" + invalid_document_batch = "InvalidDocumentBatch" + unsupported_language_code = "UnsupportedLanguageCode" + invalid_country_hint = "InvalidCountryHint" + + +class WarningCodeValue(str, Enum): + + long_words_in_document = "LongWordsInDocument" + document_truncated = "DocumentTruncated" + + +class State(str, Enum): + + not_started = "notStarted" + running = "running" + succeeded = "succeeded" + failed = "failed" + cancelled = "cancelled" + cancelling = "cancelling" + partially_completed = "partiallyCompleted" + + +class DocumentSentimentValue(str, Enum): + + positive = "positive" + neutral = "neutral" + negative = "negative" + mixed = "mixed" + + +class SentenceSentimentValue(str, Enum): + + positive = "positive" + neutral = "neutral" + negative = "negative" + + +class TokenSentimentValue(str, Enum): + + positive = "positive" + mixed = "mixed" + negative = "negative" + + +class AspectRelationType(str, Enum): + + opinion = "opinion" + aspect = "aspect" + + +class StringIndexType(str, Enum): + + text_elements_v8 = "TextElements_v8" #: Returned offset and length values will correspond to TextElements (Graphemes and Grapheme clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is written in .Net Framework or .Net Core and you will be using StringInfo. + unicode_code_point = "UnicodeCodePoint" #: Returned offset and length values will correspond to Unicode code points. Use this option if your application is written in a language that support Unicode, for example Python. + utf16_code_unit = "Utf16CodeUnit" #: Returned offset and length values will correspond to UTF-16 code units. Use this option if your application is written in a language that support Unicode, for example Java, JavaScript. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/operations/__init__.py new file mode 100644 index 000000000000..e87e22b49362 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/operations/__init__.py @@ -0,0 +1,16 @@ +# 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 ._text_analytics_client_operations import TextAnalyticsClientOperationsMixin + +__all__ = [ + 'TextAnalyticsClientOperationsMixin', +] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/operations/_text_analytics_client_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/operations/_text_analytics_client_operations.py new file mode 100644 index 000000000000..90ef0b7a6ca5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-textanalytics/azure/cognitiveservices/language/textanalytics/operations/_text_analytics_client_operations.py @@ -0,0 +1,908 @@ +# 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.pipeline import ClientRawResponse +from msrest.exceptions import HttpOperationError +from .. import models + + +class TextAnalyticsClientOperationsMixin(object): + + def analyze( + self, body=None, custom_headers=None, raw=False, **operation_config): + """Submit analysis job. + + Submit a collection of text documents for analysis. Specify one or more + unique tasks to be executed. + + :param body: Collection of documents to analyze and tasks to execute. + :type body: + ~azure.cognitiveservices.language.textanalytics.models.AnalyzeBatchInput + :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: ErrorResponse or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.textanalytics.models.ErrorResponse + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.analyze.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 = {} + + # 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 body is not None: + body_content = self._serialize.body(body, 'AnalyzeBatchInput') + 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 [202, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', response) + header_dict = { + 'Operation-Location': 'str', + } + if response.status_code == 500: + deserialized = self._deserialize('ErrorResponse', response) + header_dict = { + 'Operation-Location': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + analyze.metadata = {'url': '/analyze'} + + def analyze_status( + self, job_id, show_stats=None, top=20, skip=0, custom_headers=None, raw=False, **operation_config): + """Get analysis status and results. + + Get the status of an analysis job. A job may consist of one or more + tasks. Once all tasks are completed, the job will transition to the + completed state and results will be available for each task. + + :param job_id: Job ID for Analyze + :type job_id: str + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :param top: (Optional) Set the maximum number of results per task. + When both $top and $skip are specified, $skip is applied first. + :type top: int + :param skip: (Optional) Set the number of elements to offset in the + response. When both $top and $skip are specified, $skip is applied + first. + :type skip: int + :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` + """ + # Construct URL + url = self.analyze_status.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str') + } + 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') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=50, minimum=1) + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AnalyzeJobState', response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorResponse', 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 + analyze_status.metadata = {'url': '/analyze/jobs/{jobId}'} + + def health_status( + self, job_id, top=20, skip=0, show_stats=None, custom_headers=None, raw=False, **operation_config): + """Get healthcare analysis job status and results. + + Get details of the healthcare prediction job specified by the jobId. + + :param job_id: Job ID + :type job_id: str + :param top: (Optional) Set the maximum number of results per task. + When both $top and $skip are specified, $skip is applied first. + :type top: int + :param skip: (Optional) Set the number of elements to offset in the + response. When both $top and $skip are specified, $skip is applied + first. + :type skip: int + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :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` + """ + # Construct URL + url = self.health_status.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=50, minimum=1) + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) + 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' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HealthcareJobState', response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorResponse', 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 + health_status.metadata = {'url': '/entities/health/jobs/{jobId}'} + + def cancel_health_job( + self, job_id, custom_headers=None, raw=False, **operation_config): + """Cancel healthcare prediction job. + + Cancel healthcare prediction job. + + :param job_id: Job ID + :type job_id: str + :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: ErrorResponse or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.textanalytics.models.ErrorResponse + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.cancel_health_job.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'jobId': self._serialize.url("job_id", job_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 404, 500]: + raise HttpOperationError(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 404: + deserialized = self._deserialize('ErrorResponse', response) + header_dict = { + 'Operation-Location': 'str', + } + if response.status_code == 500: + deserialized = self._deserialize('ErrorResponse', response) + header_dict = { + 'Operation-Location': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + cancel_health_job.metadata = {'url': '/entities/health/jobs/{jobId}'} + + def health( + self, documents, model_version=None, string_index_type="TextElements_v8", custom_headers=None, raw=False, **operation_config): + """Submit healthcare analysis job. + + Start a healthcare analysis job to recognize healthcare related + entities (drugs, conditions, symptoms, etc) and their relations. + + :param documents: The set of documents to process as part of this + batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will + be used for scoring. If a model-version is not specified, the API + should default to the latest, non-preview version. + :type model_version: str + :param string_index_type: (Optional) Specifies the method used to + interpret string offsets. Defaults to Text Elements (Graphemes) + according to Unicode v8.0.0. For additional information see + https://aka.ms/text-analytics-offsets. Possible values include: + 'TextElements_v8', 'UnicodeCodePoint', 'Utf16CodeUnit' + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexType + :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: ErrorResponse or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.language.textanalytics.models.ErrorResponse + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + input = models.MultiLanguageBatchInput(documents=documents) + + # Construct URL + url = self.health.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 model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # 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 + body_content = self._serialize.body(input, 'MultiLanguageBatchInput') + + # 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 [202, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', response) + header_dict = { + 'Operation-Location': 'str', + } + if response.status_code == 500: + deserialized = self._deserialize('ErrorResponse', response) + header_dict = { + 'Operation-Location': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + health.metadata = {'url': '/entities/health/jobs'} + + def entities_recognition_general( + self, documents, model_version=None, show_stats=None, string_index_type="TextElements_v8", custom_headers=None, raw=False, **operation_config): + """Named Entity Recognition. + + The API returns a list of general named entities in a given document. + For the list of supported entity types, check Supported Entity Types in Text Analytics + API. See the Supported languages + in Text Analytics API for the list of enabled languages. + + :param documents: The set of documents to process as part of this + batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will + be used for scoring. If a model-version is not specified, the API + should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :param string_index_type: (Optional) Specifies the method used to + interpret string offsets. Defaults to Text Elements (Graphemes) + according to Unicode v8.0.0. For additional information see + https://aka.ms/text-analytics-offsets. Possible values include: + 'TextElements_v8', 'UnicodeCodePoint', 'Utf16CodeUnit' + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexType + :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` + """ + input = models.MultiLanguageBatchInput(documents=documents) + + # Construct URL + url = self.entities_recognition_general.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 model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # 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 + body_content = self._serialize.body(input, 'MultiLanguageBatchInput') + + # 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, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EntitiesResult', response) + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', 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 + entities_recognition_general.metadata = {'url': '/entities/recognition/general'} + + def entities_recognition_pii( + self, documents, model_version=None, show_stats=None, domain=None, string_index_type="TextElements_v8", custom_headers=None, raw=False, **operation_config): + """Entities containing personal information. + + The API returns a list of entities with personal information (\"SSN\", + \"Bank Account\" etc) in the document. For the list of supported entity + types, check Supported Entity Types + in Text Analytics API. See the Supported languages in Text Analytics + API for the list of enabled languages. + . + + :param documents: The set of documents to process as part of this + batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will + be used for scoring. If a model-version is not specified, the API + should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :param domain: (Optional) if specified, will set the PII domain to + include only a subset of the entity categories. Possible values + include: 'PHI', 'none'. + :type domain: str + :param string_index_type: (Optional) Specifies the method used to + interpret string offsets. Defaults to Text Elements (Graphemes) + according to Unicode v8.0.0. For additional information see + https://aka.ms/text-analytics-offsets. Possible values include: + 'TextElements_v8', 'UnicodeCodePoint', 'Utf16CodeUnit' + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexType + :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` + """ + input = models.MultiLanguageBatchInput(documents=documents) + + # Construct URL + url = self.entities_recognition_pii.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 model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if domain is not None: + query_parameters['domain'] = self._serialize.query("domain", domain, 'str') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # 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 + body_content = self._serialize.body(input, 'MultiLanguageBatchInput') + + # 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, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PiiResult', response) + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', 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 + entities_recognition_pii.metadata = {'url': '/entities/recognition/pii'} + + def entities_linking( + self, documents, model_version=None, show_stats=None, string_index_type="TextElements_v8", custom_headers=None, raw=False, **operation_config): + """Linked entities from a well-known knowledge base. + + The API returns a list of recognized entities with links to a + well-known knowledge base. See the Supported languages in Text Analytics + API for the list of enabled languages. + + :param documents: The set of documents to process as part of this + batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will + be used for scoring. If a model-version is not specified, the API + should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :param string_index_type: (Optional) Specifies the method used to + interpret string offsets. Defaults to Text Elements (Graphemes) + according to Unicode v8.0.0. For additional information see + https://aka.ms/text-analytics-offsets. Possible values include: + 'TextElements_v8', 'UnicodeCodePoint', 'Utf16CodeUnit' + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexType + :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` + """ + input = models.MultiLanguageBatchInput(documents=documents) + + # Construct URL + url = self.entities_linking.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 model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # 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 + body_content = self._serialize.body(input, 'MultiLanguageBatchInput') + + # 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, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EntityLinkingResult', response) + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', 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 + entities_linking.metadata = {'url': '/entities/linking'} + + def key_phrases( + self, documents, model_version=None, show_stats=None, custom_headers=None, raw=False, **operation_config): + """Key Phrases. + + The API returns a list of strings denoting the key phrases in the input + text. See the Supported languages in + Text Analytics API for the list of enabled languages. + + :param documents: The set of documents to process as part of this + batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will + be used for scoring. If a model-version is not specified, the API + should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :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` + """ + 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 model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + 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 + body_content = self._serialize.body(input, 'MultiLanguageBatchInput') + + # 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, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('KeyPhraseResult', response) + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', 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 + key_phrases.metadata = {'url': '/keyPhrases'} + + def languages( + self, documents, model_version=None, show_stats=None, custom_headers=None, raw=False, **operation_config): + """Detect Language. + + 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. See the Supported + languages in Text Analytics API for the list of enabled languages. + + :param documents: + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.LanguageInput] + :param model_version: (Optional) This value indicates which model will + be used for scoring. If a model-version is not specified, the API + should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :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` + """ + input = models.LanguageBatchInput(documents=documents) + + # Construct URL + url = self.languages.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 model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + 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 + body_content = self._serialize.body(input, 'LanguageBatchInput') + + # 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, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LanguageResult', response) + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', 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 + languages.metadata = {'url': '/languages'} + + def sentiment( + self, documents, model_version=None, show_stats=None, opinion_mining=None, string_index_type="TextElements_v8", custom_headers=None, raw=False, **operation_config): + """Sentiment. + + The API returns a detailed sentiment analysis for the input text. The + analysis is done in multiple levels of granularity, start from the a + document level, down to sentence and key terms (aspects) and opinions. + + :param documents: The set of documents to process as part of this + batch. + :type documents: + list[~azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput] + :param model_version: (Optional) This value indicates which model will + be used for scoring. If a model-version is not specified, the API + should default to the latest, non-preview version. + :type model_version: str + :param show_stats: (Optional) if set to true, response will contain + request and document level statistics. + :type show_stats: bool + :param opinion_mining: (Optional) if set to true, response will + contain input and document level statistics including aspect-based + sentiment analysis results. + :type opinion_mining: bool + :param string_index_type: (Optional) Specifies the method used to + interpret string offsets. Defaults to Text Elements (Graphemes) + according to Unicode v8.0.0. For additional information see + https://aka.ms/text-analytics-offsets. Possible values include: + 'TextElements_v8', 'UnicodeCodePoint', 'Utf16CodeUnit' + :type string_index_type: str or + ~azure.cognitiveservices.language.textanalytics.models.StringIndexType + :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` + """ + 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 model_version is not None: + query_parameters['model-version'] = self._serialize.query("model_version", model_version, 'str') + if show_stats is not None: + query_parameters['showStats'] = self._serialize.query("show_stats", show_stats, 'bool') + if opinion_mining is not None: + query_parameters['opinionMining'] = self._serialize.query("opinion_mining", opinion_mining, 'bool') + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # 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 + body_content = self._serialize.body(input, 'MultiLanguageBatchInput') + + # 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, 400, 500]: + raise HttpOperationError(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SentimentResponse', response) + if response.status_code == 400: + deserialized = self._deserialize('ErrorResponse', 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'}