azure-ai-textanalytics 5.3.0b1__py3-none-any.whl → 6.0.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of azure-ai-textanalytics might be problematic. Click here for more details.

Files changed (128) hide show
  1. azure/ai/textanalytics/__init__.py +26 -197
  2. azure/ai/textanalytics/_client.py +111 -0
  3. azure/ai/textanalytics/_configuration.py +73 -0
  4. azure/ai/textanalytics/{_generated/v2022_05_01/operations → _operations}/__init__.py +13 -8
  5. azure/ai/textanalytics/_operations/_operations.py +716 -0
  6. azure/ai/textanalytics/{_generated/v2022_05_01/models → _operations}/_patch.py +8 -6
  7. azure/ai/textanalytics/_patch.py +350 -0
  8. azure/ai/textanalytics/{_generated/aio → _utils}/__init__.py +1 -5
  9. azure/ai/textanalytics/_utils/model_base.py +1237 -0
  10. azure/ai/textanalytics/{_generated/_serialization.py → _utils/serialization.py} +640 -616
  11. azure/ai/textanalytics/{_generated/v2022_05_01/aio/_vendor.py → _utils/utils.py} +10 -12
  12. azure/ai/textanalytics/_version.py +8 -7
  13. azure/ai/textanalytics/aio/__init__.py +25 -14
  14. azure/ai/textanalytics/aio/_client.py +115 -0
  15. azure/ai/textanalytics/aio/_configuration.py +75 -0
  16. azure/ai/textanalytics/{_generated/v2022_10_01_preview/aio/operations → aio/_operations}/__init__.py +13 -8
  17. azure/ai/textanalytics/aio/_operations/_operations.py +623 -0
  18. azure/ai/textanalytics/{_generated/v2022_05_01 → aio/_operations}/_patch.py +8 -6
  19. azure/ai/textanalytics/aio/_patch.py +344 -0
  20. azure/ai/textanalytics/models/__init__.py +402 -0
  21. azure/ai/textanalytics/models/_enums.py +1979 -0
  22. azure/ai/textanalytics/models/_models.py +6641 -0
  23. azure/ai/textanalytics/{_generated/v2022_05_01/aio → models}/_patch.py +8 -6
  24. azure/ai/textanalytics/py.typed +1 -0
  25. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/METADATA +755 -319
  26. azure_ai_textanalytics-6.0.0b1.dist-info/RECORD +29 -0
  27. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/WHEEL +1 -1
  28. azure/ai/textanalytics/_base_client.py +0 -111
  29. azure/ai/textanalytics/_check.py +0 -22
  30. azure/ai/textanalytics/_dict_mixin.py +0 -54
  31. azure/ai/textanalytics/_generated/__init__.py +0 -16
  32. azure/ai/textanalytics/_generated/_configuration.py +0 -70
  33. azure/ai/textanalytics/_generated/_operations_mixin.py +0 -795
  34. azure/ai/textanalytics/_generated/_text_analytics_client.py +0 -126
  35. azure/ai/textanalytics/_generated/_version.py +0 -8
  36. azure/ai/textanalytics/_generated/aio/_configuration.py +0 -66
  37. azure/ai/textanalytics/_generated/aio/_operations_mixin.py +0 -776
  38. azure/ai/textanalytics/_generated/aio/_text_analytics_client.py +0 -124
  39. azure/ai/textanalytics/_generated/models.py +0 -8
  40. azure/ai/textanalytics/_generated/v2022_05_01/__init__.py +0 -20
  41. azure/ai/textanalytics/_generated/v2022_05_01/_configuration.py +0 -72
  42. azure/ai/textanalytics/_generated/v2022_05_01/_text_analytics_client.py +0 -100
  43. azure/ai/textanalytics/_generated/v2022_05_01/_vendor.py +0 -45
  44. azure/ai/textanalytics/_generated/v2022_05_01/aio/__init__.py +0 -20
  45. azure/ai/textanalytics/_generated/v2022_05_01/aio/_configuration.py +0 -71
  46. azure/ai/textanalytics/_generated/v2022_05_01/aio/_text_analytics_client.py +0 -97
  47. azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/__init__.py +0 -18
  48. azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_patch.py +0 -121
  49. azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_text_analytics_client_operations.py +0 -603
  50. azure/ai/textanalytics/_generated/v2022_05_01/models/__init__.py +0 -281
  51. azure/ai/textanalytics/_generated/v2022_05_01/models/_models_py3.py +0 -5722
  52. azure/ai/textanalytics/_generated/v2022_05_01/models/_text_analytics_client_enums.py +0 -439
  53. azure/ai/textanalytics/_generated/v2022_05_01/operations/_patch.py +0 -120
  54. azure/ai/textanalytics/_generated/v2022_05_01/operations/_text_analytics_client_operations.py +0 -744
  55. azure/ai/textanalytics/_generated/v2022_10_01_preview/__init__.py +0 -20
  56. azure/ai/textanalytics/_generated/v2022_10_01_preview/_configuration.py +0 -72
  57. azure/ai/textanalytics/_generated/v2022_10_01_preview/_patch.py +0 -19
  58. azure/ai/textanalytics/_generated/v2022_10_01_preview/_text_analytics_client.py +0 -100
  59. azure/ai/textanalytics/_generated/v2022_10_01_preview/_vendor.py +0 -45
  60. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/__init__.py +0 -20
  61. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_configuration.py +0 -71
  62. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_patch.py +0 -19
  63. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_text_analytics_client.py +0 -97
  64. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_vendor.py +0 -27
  65. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_patch.py +0 -121
  66. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_text_analytics_client_operations.py +0 -603
  67. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/__init__.py +0 -407
  68. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_models_py3.py +0 -8462
  69. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_patch.py +0 -72
  70. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_text_analytics_client_enums.py +0 -730
  71. azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/__init__.py +0 -18
  72. azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_patch.py +0 -120
  73. azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_text_analytics_client_operations.py +0 -744
  74. azure/ai/textanalytics/_generated/v3_0/__init__.py +0 -20
  75. azure/ai/textanalytics/_generated/v3_0/_configuration.py +0 -66
  76. azure/ai/textanalytics/_generated/v3_0/_patch.py +0 -31
  77. azure/ai/textanalytics/_generated/v3_0/_text_analytics_client.py +0 -96
  78. azure/ai/textanalytics/_generated/v3_0/_vendor.py +0 -33
  79. azure/ai/textanalytics/_generated/v3_0/aio/__init__.py +0 -20
  80. azure/ai/textanalytics/_generated/v3_0/aio/_configuration.py +0 -65
  81. azure/ai/textanalytics/_generated/v3_0/aio/_patch.py +0 -31
  82. azure/ai/textanalytics/_generated/v3_0/aio/_text_analytics_client.py +0 -93
  83. azure/ai/textanalytics/_generated/v3_0/aio/_vendor.py +0 -27
  84. azure/ai/textanalytics/_generated/v3_0/aio/operations/__init__.py +0 -18
  85. azure/ai/textanalytics/_generated/v3_0/aio/operations/_patch.py +0 -19
  86. azure/ai/textanalytics/_generated/v3_0/aio/operations/_text_analytics_client_operations.py +0 -428
  87. azure/ai/textanalytics/_generated/v3_0/models/__init__.py +0 -81
  88. azure/ai/textanalytics/_generated/v3_0/models/_models_py3.py +0 -1467
  89. azure/ai/textanalytics/_generated/v3_0/models/_patch.py +0 -19
  90. azure/ai/textanalytics/_generated/v3_0/models/_text_analytics_client_enums.py +0 -58
  91. azure/ai/textanalytics/_generated/v3_0/operations/__init__.py +0 -18
  92. azure/ai/textanalytics/_generated/v3_0/operations/_patch.py +0 -19
  93. azure/ai/textanalytics/_generated/v3_0/operations/_text_analytics_client_operations.py +0 -604
  94. azure/ai/textanalytics/_generated/v3_1/__init__.py +0 -20
  95. azure/ai/textanalytics/_generated/v3_1/_configuration.py +0 -66
  96. azure/ai/textanalytics/_generated/v3_1/_patch.py +0 -31
  97. azure/ai/textanalytics/_generated/v3_1/_text_analytics_client.py +0 -98
  98. azure/ai/textanalytics/_generated/v3_1/_vendor.py +0 -45
  99. azure/ai/textanalytics/_generated/v3_1/aio/__init__.py +0 -20
  100. azure/ai/textanalytics/_generated/v3_1/aio/_configuration.py +0 -65
  101. azure/ai/textanalytics/_generated/v3_1/aio/_patch.py +0 -31
  102. azure/ai/textanalytics/_generated/v3_1/aio/_text_analytics_client.py +0 -95
  103. azure/ai/textanalytics/_generated/v3_1/aio/_vendor.py +0 -27
  104. azure/ai/textanalytics/_generated/v3_1/aio/operations/__init__.py +0 -18
  105. azure/ai/textanalytics/_generated/v3_1/aio/operations/_patch.py +0 -19
  106. azure/ai/textanalytics/_generated/v3_1/aio/operations/_text_analytics_client_operations.py +0 -1291
  107. azure/ai/textanalytics/_generated/v3_1/models/__init__.py +0 -205
  108. azure/ai/textanalytics/_generated/v3_1/models/_models_py3.py +0 -3976
  109. azure/ai/textanalytics/_generated/v3_1/models/_patch.py +0 -19
  110. azure/ai/textanalytics/_generated/v3_1/models/_text_analytics_client_enums.py +0 -367
  111. azure/ai/textanalytics/_generated/v3_1/operations/__init__.py +0 -18
  112. azure/ai/textanalytics/_generated/v3_1/operations/_patch.py +0 -19
  113. azure/ai/textanalytics/_generated/v3_1/operations/_text_analytics_client_operations.py +0 -1709
  114. azure/ai/textanalytics/_lro.py +0 -552
  115. azure/ai/textanalytics/_models.py +0 -3142
  116. azure/ai/textanalytics/_policies.py +0 -66
  117. azure/ai/textanalytics/_request_handlers.py +0 -104
  118. azure/ai/textanalytics/_response_handlers.py +0 -580
  119. azure/ai/textanalytics/_text_analytics_client.py +0 -1802
  120. azure/ai/textanalytics/_user_agent.py +0 -8
  121. azure/ai/textanalytics/_validate.py +0 -113
  122. azure/ai/textanalytics/aio/_base_client_async.py +0 -95
  123. azure/ai/textanalytics/aio/_lro_async.py +0 -501
  124. azure/ai/textanalytics/aio/_response_handlers_async.py +0 -94
  125. azure/ai/textanalytics/aio/_text_analytics_client_async.py +0 -1800
  126. azure_ai_textanalytics-5.3.0b1.dist-info/RECORD +0 -115
  127. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info/licenses}/LICENSE +0 -0
  128. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/top_level.txt +0 -0
@@ -1,428 +0,0 @@
1
- # pylint: disable=too-many-lines
2
- # coding=utf-8
3
- # --------------------------------------------------------------------------
4
- # Copyright (c) Microsoft Corporation. All rights reserved.
5
- # Licensed under the MIT License. See License.txt in the project root for license information.
6
- # Code generated by Microsoft (R) AutoRest Code Generator.
7
- # Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
- # --------------------------------------------------------------------------
9
- from typing import Any, Callable, Dict, List, Optional, TypeVar
10
-
11
- from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
12
- from azure.core.pipeline import PipelineResponse
13
- from azure.core.pipeline.transport import AsyncHttpResponse
14
- from azure.core.rest import HttpRequest
15
- from azure.core.tracing.decorator_async import distributed_trace_async
16
- from azure.core.utils import case_insensitive_dict
17
-
18
- from ... import models as _models
19
- from ..._vendor import _convert_request
20
- from ...operations._text_analytics_client_operations import build_entities_linking_request, build_entities_recognition_general_request, build_key_phrases_request, build_languages_request, build_sentiment_request
21
- from .._vendor import MixinABC
22
- T = TypeVar('T')
23
- ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
24
-
25
- class TextAnalyticsClientOperationsMixin(MixinABC):
26
-
27
- @distributed_trace_async
28
- async def entities_recognition_general(
29
- self,
30
- documents: List[_models.MultiLanguageInput],
31
- model_version: Optional[str] = None,
32
- show_stats: Optional[bool] = None,
33
- **kwargs: Any
34
- ) -> _models.EntitiesResult:
35
- """Named Entity Recognition.
36
-
37
- The API returns a list of general named entities in a given document. For the list of supported
38
- entity types, check :code:`<a href="https://aka.ms/taner">Supported Entity Types in Text
39
- Analytics API</a>`. See the :code:`<a href="https://aka.ms/talangs">Supported languages in Text
40
- Analytics API</a>` for the list of enabled languages.
41
-
42
- :param documents: The set of documents to process as part of this batch. Required.
43
- :type documents: list[~azure.ai.textanalytics.v3_0.models.MultiLanguageInput]
44
- :param model_version: (Optional) This value indicates which model will be used for scoring. If
45
- a model-version is not specified, the API should default to the latest, non-preview version.
46
- Default value is None.
47
- :type model_version: str
48
- :param show_stats: (Optional) if set to true, response will contain input and document level
49
- statistics. Default value is None.
50
- :type show_stats: bool
51
- :keyword callable cls: A custom type or function that will be passed the direct response
52
- :return: EntitiesResult or the result of cls(response)
53
- :rtype: ~azure.ai.textanalytics.v3_0.models.EntitiesResult
54
- :raises ~azure.core.exceptions.HttpResponseError:
55
- """
56
- error_map = {
57
- 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
58
- }
59
- error_map.update(kwargs.pop('error_map', {}) or {})
60
-
61
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
62
- _params = kwargs.pop("params", {}) or {}
63
-
64
- content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str
65
- cls = kwargs.pop('cls', None) # type: ClsType[_models.EntitiesResult]
66
-
67
- _input = _models.MultiLanguageBatchInput(documents=documents)
68
- _json = self._serialize.body(_input, 'MultiLanguageBatchInput')
69
-
70
- request = build_entities_recognition_general_request(
71
- model_version=model_version,
72
- show_stats=show_stats,
73
- content_type=content_type,
74
- json=_json,
75
- template_url=self.entities_recognition_general.metadata['url'],
76
- headers=_headers,
77
- params=_params,
78
- )
79
- request = _convert_request(request)
80
- path_format_arguments = {
81
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
82
- }
83
- request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
84
-
85
- pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
86
- request,
87
- stream=False,
88
- **kwargs
89
- )
90
-
91
- response = pipeline_response.http_response
92
-
93
- if response.status_code not in [200]:
94
- map_error(status_code=response.status_code, response=response, error_map=error_map)
95
- error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
96
- raise HttpResponseError(response=response, model=error)
97
-
98
- deserialized = self._deserialize('EntitiesResult', pipeline_response)
99
-
100
- if cls:
101
- return cls(pipeline_response, deserialized, {})
102
-
103
- return deserialized
104
-
105
- entities_recognition_general.metadata = {'url': "/entities/recognition/general"} # type: ignore
106
-
107
-
108
- @distributed_trace_async
109
- async def entities_linking(
110
- self,
111
- documents: List[_models.MultiLanguageInput],
112
- model_version: Optional[str] = None,
113
- show_stats: Optional[bool] = None,
114
- **kwargs: Any
115
- ) -> _models.EntityLinkingResult:
116
- """Linked entities from a well-known knowledge base.
117
-
118
- The API returns a list of recognized entities with links to a well-known knowledge base. See
119
- the :code:`<a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a>` for
120
- the list of enabled languages.
121
-
122
- :param documents: The set of documents to process as part of this batch. Required.
123
- :type documents: list[~azure.ai.textanalytics.v3_0.models.MultiLanguageInput]
124
- :param model_version: (Optional) This value indicates which model will be used for scoring. If
125
- a model-version is not specified, the API should default to the latest, non-preview version.
126
- Default value is None.
127
- :type model_version: str
128
- :param show_stats: (Optional) if set to true, response will contain input and document level
129
- statistics. Default value is None.
130
- :type show_stats: bool
131
- :keyword callable cls: A custom type or function that will be passed the direct response
132
- :return: EntityLinkingResult or the result of cls(response)
133
- :rtype: ~azure.ai.textanalytics.v3_0.models.EntityLinkingResult
134
- :raises ~azure.core.exceptions.HttpResponseError:
135
- """
136
- error_map = {
137
- 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
138
- }
139
- error_map.update(kwargs.pop('error_map', {}) or {})
140
-
141
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
142
- _params = kwargs.pop("params", {}) or {}
143
-
144
- content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str
145
- cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityLinkingResult]
146
-
147
- _input = _models.MultiLanguageBatchInput(documents=documents)
148
- _json = self._serialize.body(_input, 'MultiLanguageBatchInput')
149
-
150
- request = build_entities_linking_request(
151
- model_version=model_version,
152
- show_stats=show_stats,
153
- content_type=content_type,
154
- json=_json,
155
- template_url=self.entities_linking.metadata['url'],
156
- headers=_headers,
157
- params=_params,
158
- )
159
- request = _convert_request(request)
160
- path_format_arguments = {
161
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
162
- }
163
- request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
164
-
165
- pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
166
- request,
167
- stream=False,
168
- **kwargs
169
- )
170
-
171
- response = pipeline_response.http_response
172
-
173
- if response.status_code not in [200]:
174
- map_error(status_code=response.status_code, response=response, error_map=error_map)
175
- error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
176
- raise HttpResponseError(response=response, model=error)
177
-
178
- deserialized = self._deserialize('EntityLinkingResult', pipeline_response)
179
-
180
- if cls:
181
- return cls(pipeline_response, deserialized, {})
182
-
183
- return deserialized
184
-
185
- entities_linking.metadata = {'url': "/entities/linking"} # type: ignore
186
-
187
-
188
- @distributed_trace_async
189
- async def key_phrases(
190
- self,
191
- documents: List[_models.MultiLanguageInput],
192
- model_version: Optional[str] = None,
193
- show_stats: Optional[bool] = None,
194
- **kwargs: Any
195
- ) -> _models.KeyPhraseResult:
196
- """Key Phrases.
197
-
198
- The API returns a list of strings denoting the key phrases in the input text. See the :code:`<a
199
- href="https://aka.ms/talangs">Supported languages in Text Analytics API</a>` for the list of
200
- enabled languages.
201
-
202
- :param documents: The set of documents to process as part of this batch. Required.
203
- :type documents: list[~azure.ai.textanalytics.v3_0.models.MultiLanguageInput]
204
- :param model_version: (Optional) This value indicates which model will be used for scoring. If
205
- a model-version is not specified, the API should default to the latest, non-preview version.
206
- Default value is None.
207
- :type model_version: str
208
- :param show_stats: (Optional) if set to true, response will contain input and document level
209
- statistics. Default value is None.
210
- :type show_stats: bool
211
- :keyword callable cls: A custom type or function that will be passed the direct response
212
- :return: KeyPhraseResult or the result of cls(response)
213
- :rtype: ~azure.ai.textanalytics.v3_0.models.KeyPhraseResult
214
- :raises ~azure.core.exceptions.HttpResponseError:
215
- """
216
- error_map = {
217
- 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
218
- }
219
- error_map.update(kwargs.pop('error_map', {}) or {})
220
-
221
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
222
- _params = kwargs.pop("params", {}) or {}
223
-
224
- content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str
225
- cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyPhraseResult]
226
-
227
- _input = _models.MultiLanguageBatchInput(documents=documents)
228
- _json = self._serialize.body(_input, 'MultiLanguageBatchInput')
229
-
230
- request = build_key_phrases_request(
231
- model_version=model_version,
232
- show_stats=show_stats,
233
- content_type=content_type,
234
- json=_json,
235
- template_url=self.key_phrases.metadata['url'],
236
- headers=_headers,
237
- params=_params,
238
- )
239
- request = _convert_request(request)
240
- path_format_arguments = {
241
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
242
- }
243
- request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
244
-
245
- pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
246
- request,
247
- stream=False,
248
- **kwargs
249
- )
250
-
251
- response = pipeline_response.http_response
252
-
253
- if response.status_code not in [200]:
254
- map_error(status_code=response.status_code, response=response, error_map=error_map)
255
- error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
256
- raise HttpResponseError(response=response, model=error)
257
-
258
- deserialized = self._deserialize('KeyPhraseResult', pipeline_response)
259
-
260
- if cls:
261
- return cls(pipeline_response, deserialized, {})
262
-
263
- return deserialized
264
-
265
- key_phrases.metadata = {'url': "/keyPhrases"} # type: ignore
266
-
267
-
268
- @distributed_trace_async
269
- async def languages(
270
- self,
271
- documents: List[_models.LanguageInput],
272
- model_version: Optional[str] = None,
273
- show_stats: Optional[bool] = None,
274
- **kwargs: Any
275
- ) -> _models.LanguageResult:
276
- """Detect Language.
277
-
278
- The API returns the detected language and a numeric score between 0 and 1. Scores close to 1
279
- indicate 100% certainty that the identified language is true. See the :code:`<a
280
- href="https://aka.ms/talangs">Supported languages in Text Analytics API</a>` for the list of
281
- enabled languages.
282
-
283
- :param documents: Required.
284
- :type documents: list[~azure.ai.textanalytics.v3_0.models.LanguageInput]
285
- :param model_version: (Optional) This value indicates which model will be used for scoring. If
286
- a model-version is not specified, the API should default to the latest, non-preview version.
287
- Default value is None.
288
- :type model_version: str
289
- :param show_stats: (Optional) if set to true, response will contain input and document level
290
- statistics. Default value is None.
291
- :type show_stats: bool
292
- :keyword callable cls: A custom type or function that will be passed the direct response
293
- :return: LanguageResult or the result of cls(response)
294
- :rtype: ~azure.ai.textanalytics.v3_0.models.LanguageResult
295
- :raises ~azure.core.exceptions.HttpResponseError:
296
- """
297
- error_map = {
298
- 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
299
- }
300
- error_map.update(kwargs.pop('error_map', {}) or {})
301
-
302
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
303
- _params = kwargs.pop("params", {}) or {}
304
-
305
- content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str
306
- cls = kwargs.pop('cls', None) # type: ClsType[_models.LanguageResult]
307
-
308
- _input = _models.LanguageBatchInput(documents=documents)
309
- _json = self._serialize.body(_input, 'LanguageBatchInput')
310
-
311
- request = build_languages_request(
312
- model_version=model_version,
313
- show_stats=show_stats,
314
- content_type=content_type,
315
- json=_json,
316
- template_url=self.languages.metadata['url'],
317
- headers=_headers,
318
- params=_params,
319
- )
320
- request = _convert_request(request)
321
- path_format_arguments = {
322
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
323
- }
324
- request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
325
-
326
- pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
327
- request,
328
- stream=False,
329
- **kwargs
330
- )
331
-
332
- response = pipeline_response.http_response
333
-
334
- if response.status_code not in [200]:
335
- map_error(status_code=response.status_code, response=response, error_map=error_map)
336
- error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
337
- raise HttpResponseError(response=response, model=error)
338
-
339
- deserialized = self._deserialize('LanguageResult', pipeline_response)
340
-
341
- if cls:
342
- return cls(pipeline_response, deserialized, {})
343
-
344
- return deserialized
345
-
346
- languages.metadata = {'url': "/languages"} # type: ignore
347
-
348
-
349
- @distributed_trace_async
350
- async def sentiment(
351
- self,
352
- documents: List[_models.MultiLanguageInput],
353
- model_version: Optional[str] = None,
354
- show_stats: Optional[bool] = None,
355
- **kwargs: Any
356
- ) -> _models.SentimentResponse:
357
- """Sentiment.
358
-
359
- The API returns a sentiment prediction, as well as sentiment scores for each sentiment class
360
- (Positive, Negative, and Neutral) for the document and each sentence within it. See the
361
- :code:`<a href="https://aka.ms/talangs">Supported languages in Text Analytics API</a>` for the
362
- list of enabled languages.
363
-
364
- :param documents: The set of documents to process as part of this batch. Required.
365
- :type documents: list[~azure.ai.textanalytics.v3_0.models.MultiLanguageInput]
366
- :param model_version: (Optional) This value indicates which model will be used for scoring. If
367
- a model-version is not specified, the API should default to the latest, non-preview version.
368
- Default value is None.
369
- :type model_version: str
370
- :param show_stats: (Optional) if set to true, response will contain input and document level
371
- statistics. Default value is None.
372
- :type show_stats: bool
373
- :keyword callable cls: A custom type or function that will be passed the direct response
374
- :return: SentimentResponse or the result of cls(response)
375
- :rtype: ~azure.ai.textanalytics.v3_0.models.SentimentResponse
376
- :raises ~azure.core.exceptions.HttpResponseError:
377
- """
378
- error_map = {
379
- 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
380
- }
381
- error_map.update(kwargs.pop('error_map', {}) or {})
382
-
383
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
384
- _params = kwargs.pop("params", {}) or {}
385
-
386
- content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str
387
- cls = kwargs.pop('cls', None) # type: ClsType[_models.SentimentResponse]
388
-
389
- _input = _models.MultiLanguageBatchInput(documents=documents)
390
- _json = self._serialize.body(_input, 'MultiLanguageBatchInput')
391
-
392
- request = build_sentiment_request(
393
- model_version=model_version,
394
- show_stats=show_stats,
395
- content_type=content_type,
396
- json=_json,
397
- template_url=self.sentiment.metadata['url'],
398
- headers=_headers,
399
- params=_params,
400
- )
401
- request = _convert_request(request)
402
- path_format_arguments = {
403
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
404
- }
405
- request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
406
-
407
- pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
408
- request,
409
- stream=False,
410
- **kwargs
411
- )
412
-
413
- response = pipeline_response.http_response
414
-
415
- if response.status_code not in [200]:
416
- map_error(status_code=response.status_code, response=response, error_map=error_map)
417
- error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
418
- raise HttpResponseError(response=response, model=error)
419
-
420
- deserialized = self._deserialize('SentimentResponse', pipeline_response)
421
-
422
- if cls:
423
- return cls(pipeline_response, deserialized, {})
424
-
425
- return deserialized
426
-
427
- sentiment.metadata = {'url': "/sentiment"} # type: ignore
428
-
@@ -1,81 +0,0 @@
1
- # coding=utf-8
2
- # --------------------------------------------------------------------------
3
- # Copyright (c) Microsoft Corporation. All rights reserved.
4
- # Licensed under the MIT License. See License.txt in the project root for license information.
5
- # Code generated by Microsoft (R) AutoRest Code Generator.
6
- # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- # --------------------------------------------------------------------------
8
-
9
- from ._models_py3 import DetectedLanguage
10
- from ._models_py3 import DocumentEntities
11
- from ._models_py3 import DocumentError
12
- from ._models_py3 import DocumentKeyPhrases
13
- from ._models_py3 import DocumentLanguage
14
- from ._models_py3 import DocumentLinkedEntities
15
- from ._models_py3 import DocumentSentiment
16
- from ._models_py3 import DocumentStatistics
17
- from ._models_py3 import EntitiesResult
18
- from ._models_py3 import Entity
19
- from ._models_py3 import EntityLinkingResult
20
- from ._models_py3 import ErrorResponse
21
- from ._models_py3 import InnerError
22
- from ._models_py3 import KeyPhraseResult
23
- from ._models_py3 import LanguageBatchInput
24
- from ._models_py3 import LanguageInput
25
- from ._models_py3 import LanguageResult
26
- from ._models_py3 import LinkedEntity
27
- from ._models_py3 import Match
28
- from ._models_py3 import MultiLanguageBatchInput
29
- from ._models_py3 import MultiLanguageInput
30
- from ._models_py3 import RequestStatistics
31
- from ._models_py3 import SentenceSentiment
32
- from ._models_py3 import SentimentConfidenceScorePerLabel
33
- from ._models_py3 import SentimentResponse
34
- from ._models_py3 import TextAnalyticsError
35
- from ._models_py3 import TextAnalyticsWarning
36
-
37
-
38
- from ._text_analytics_client_enums import DocumentSentimentValue
39
- from ._text_analytics_client_enums import ErrorCodeValue
40
- from ._text_analytics_client_enums import InnerErrorCodeValue
41
- from ._text_analytics_client_enums import SentenceSentimentValue
42
- from ._text_analytics_client_enums import WarningCodeValue
43
- from ._patch import __all__ as _patch_all
44
- from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
45
- from ._patch import patch_sdk as _patch_sdk
46
- __all__ = [
47
- 'DetectedLanguage',
48
- 'DocumentEntities',
49
- 'DocumentError',
50
- 'DocumentKeyPhrases',
51
- 'DocumentLanguage',
52
- 'DocumentLinkedEntities',
53
- 'DocumentSentiment',
54
- 'DocumentStatistics',
55
- 'EntitiesResult',
56
- 'Entity',
57
- 'EntityLinkingResult',
58
- 'ErrorResponse',
59
- 'InnerError',
60
- 'KeyPhraseResult',
61
- 'LanguageBatchInput',
62
- 'LanguageInput',
63
- 'LanguageResult',
64
- 'LinkedEntity',
65
- 'Match',
66
- 'MultiLanguageBatchInput',
67
- 'MultiLanguageInput',
68
- 'RequestStatistics',
69
- 'SentenceSentiment',
70
- 'SentimentConfidenceScorePerLabel',
71
- 'SentimentResponse',
72
- 'TextAnalyticsError',
73
- 'TextAnalyticsWarning',
74
- 'DocumentSentimentValue',
75
- 'ErrorCodeValue',
76
- 'InnerErrorCodeValue',
77
- 'SentenceSentimentValue',
78
- 'WarningCodeValue',
79
- ]
80
- __all__.extend([p for p in _patch_all if p not in __all__])
81
- _patch_sdk()