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,66 +0,0 @@
1
- # ------------------------------------
2
- # Copyright (c) Microsoft Corporation.
3
- # Licensed under the MIT License.
4
- # ------------------------------------
5
-
6
- from azure.core.pipeline.policies import ContentDecodePolicy
7
- from azure.core.pipeline.policies import SansIOHTTPPolicy
8
- from azure.core.exceptions import HttpResponseError
9
- from ._models import TextDocumentBatchStatistics
10
- from ._lro import _FINISHED
11
-
12
-
13
- class TextAnalyticsResponseHookPolicy(SansIOHTTPPolicy):
14
- def __init__(self, **kwargs):
15
- self._response_callback = kwargs.get("raw_response_hook")
16
- self._is_lro = None
17
- super().__init__()
18
-
19
- def on_request(self, request):
20
- self._response_callback = request.context.options.pop(
21
- "raw_response_hook", self._response_callback
22
- )
23
-
24
- def on_response(self, request, response):
25
- if self._is_lro is None:
26
- # determine LRO based off of initial response. If 202, we say it's an LRO
27
- self._is_lro = response.http_response.status_code == 202
28
- if self._response_callback:
29
- data = ContentDecodePolicy.deserialize_from_http_generics(
30
- response.http_response
31
- )
32
- if self._is_lro and (not data or data.get("status", "").lower() not in _FINISHED):
33
- return
34
- if response.http_response.status_code == 429:
35
- return
36
- if data:
37
- inner = data.get("results", data) # language API compat
38
- statistics = inner.get("statistics", None)
39
- model_version = inner.get("modelVersion", None)
40
- batch_statistics = TextDocumentBatchStatistics._from_generated( # pylint: disable=protected-access
41
- statistics
42
- )
43
- response.statistics = batch_statistics
44
- response.model_version = model_version
45
- response.raw_response = data
46
- self._response_callback(response)
47
-
48
-
49
- class QuotaExceededPolicy(SansIOHTTPPolicy):
50
- """Raises an exception immediately when the call quota volume has been exceeded in a F0
51
- tier language resource. This is to avoid waiting the Retry-After time returned in
52
- the response.
53
- """
54
-
55
- def on_response(self, request, response):
56
- """Is executed after the request comes back from the policy.
57
-
58
- :param request: Request to be modified after returning from the policy.
59
- :type request: ~azure.core.pipeline.PipelineRequest
60
- :param response: Pipeline response object
61
- :type response: ~azure.core.pipeline.PipelineResponse
62
- """
63
- http_response = response.http_response
64
- if http_response.status_code == 403 and \
65
- "Out of call volume quota for TextAnalytics F0 pricing tier" in http_response.text():
66
- raise HttpResponseError(http_response.text(), response=http_response)
@@ -1,104 +0,0 @@
1
- # ------------------------------------
2
- # Copyright (c) Microsoft Corporation.
3
- # Licensed under the MIT License.
4
- # ------------------------------------
5
-
6
-
7
- from ._models import (
8
- DetectLanguageInput,
9
- TextDocumentInput,
10
- _AnalyzeActionsType,
11
- )
12
-
13
-
14
- def _validate_input(documents, hint, whole_input_hint):
15
- """Validate that batch input has either all string docs
16
- or dict/DetectLanguageInput/TextDocumentInput, not a mix of both.
17
- Assign country and language hints on a whole batch or per-item
18
- basis.
19
-
20
- :param list documents: The input documents.
21
- :return: A list of DetectLanguageInput or TextDocumentInput
22
- """
23
- if not documents:
24
- raise ValueError("Input documents can not be empty or None")
25
-
26
- if isinstance(documents, str):
27
- raise TypeError("Input documents cannot be a string.")
28
-
29
- if isinstance(documents, dict):
30
- raise TypeError("Input documents cannot be a dict")
31
-
32
- if not all(isinstance(x, str) for x in documents):
33
- if not all(
34
- isinstance(x, (dict, TextDocumentInput, DetectLanguageInput))
35
- for x in documents
36
- ):
37
- raise TypeError(
38
- "Mixing string and dictionary/object document input unsupported."
39
- )
40
-
41
- request_batch = []
42
- for idx, doc in enumerate(documents):
43
- if isinstance(doc, str):
44
- if hint == "country_hint" and whole_input_hint.lower() == "none":
45
- whole_input_hint = ""
46
- document = {"id": str(idx), hint: whole_input_hint, "text": doc}
47
- request_batch.append(document)
48
- if isinstance(doc, dict):
49
- item_hint = doc.get(hint, None)
50
- if item_hint is None:
51
- doc = {
52
- "id": doc.get("id", None),
53
- hint: whole_input_hint,
54
- "text": doc.get("text", None),
55
- }
56
- elif item_hint.lower() == "none":
57
- doc = {
58
- "id": doc.get("id", None),
59
- hint: "",
60
- "text": doc.get("text", None),
61
- }
62
- request_batch.append(doc)
63
- if isinstance(doc, TextDocumentInput):
64
- item_hint = doc.language
65
- if item_hint is None:
66
- doc = TextDocumentInput(
67
- id=doc.id, language=whole_input_hint, text=doc.text
68
- )
69
- request_batch.append(doc)
70
- if isinstance(doc, DetectLanguageInput):
71
- item_hint = doc.country_hint
72
- if item_hint is None:
73
- doc = DetectLanguageInput(
74
- id=doc.id, country_hint=whole_input_hint, text=doc.text
75
- )
76
- elif item_hint.lower() == "none":
77
- doc = DetectLanguageInput(id=doc.id, country_hint="", text=doc.text)
78
- request_batch.append(doc)
79
-
80
- return request_batch
81
-
82
-
83
- def _determine_action_type(action): # pylint: disable=too-many-return-statements
84
- if action.__class__.__name__ in ["EntitiesTask", "EntitiesLROTask"]:
85
- return _AnalyzeActionsType.RECOGNIZE_ENTITIES
86
- if action.__class__.__name__ in ["PiiTask", "PiiLROTask"]:
87
- return _AnalyzeActionsType.RECOGNIZE_PII_ENTITIES
88
- if action.__class__.__name__ in ["EntityLinkingTask", "EntityLinkingLROTask"]:
89
- return _AnalyzeActionsType.RECOGNIZE_LINKED_ENTITIES
90
- if action.__class__.__name__ in ["SentimentAnalysisTask", "SentimentAnalysisLROTask"]:
91
- return _AnalyzeActionsType.ANALYZE_SENTIMENT
92
- if action.__class__.__name__ == "CustomEntitiesLROTask":
93
- return _AnalyzeActionsType.RECOGNIZE_CUSTOM_ENTITIES
94
- if action.__class__.__name__ == "CustomSingleLabelClassificationLROTask":
95
- return _AnalyzeActionsType.SINGLE_LABEL_CLASSIFY
96
- if action.__class__.__name__ == "CustomMultiLabelClassificationLROTask":
97
- return _AnalyzeActionsType.MULTI_LABEL_CLASSIFY
98
- if action.__class__.__name__ == "HealthcareLROTask":
99
- return _AnalyzeActionsType.ANALYZE_HEALTHCARE_ENTITIES
100
- if action.__class__.__name__ == "ExtractiveSummarizationLROTask":
101
- return _AnalyzeActionsType.EXTRACT_SUMMARY
102
- if action.__class__.__name__ == "AbstractiveSummarizationLROTask":
103
- return _AnalyzeActionsType.ABSTRACT_SUMMARY
104
- return _AnalyzeActionsType.EXTRACT_KEY_PHRASES