@azure/ai-text-analytics 5.1.1-alpha.20250619.1 → 5.1.1-alpha.20250730.1
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.
- package/dist/browser/analyzeActionsResult.js +6 -7
- package/dist/browser/analyzeActionsResult.js.map +1 -1
- package/dist/browser/analyzeHealthcareEntitiesResult.js +7 -3
- package/dist/browser/analyzeHealthcareEntitiesResult.js.map +1 -1
- package/dist/browser/analyzeSentimentResult.js +7 -4
- package/dist/browser/analyzeSentimentResult.js.map +1 -1
- package/dist/browser/detectLanguageResult.js +4 -1
- package/dist/browser/detectLanguageResult.js.map +1 -1
- package/dist/browser/extractKeyPhrasesResult.js +4 -1
- package/dist/browser/extractKeyPhrasesResult.js.map +1 -1
- package/dist/browser/generated/generatedClient.js +12 -4
- package/dist/browser/generated/generatedClient.js.map +1 -1
- package/dist/browser/generated/models/mappers.js +44 -10
- package/dist/browser/generated/models/mappers.js.map +1 -1
- package/dist/browser/lro/analyze/operation.js +27 -18
- package/dist/browser/lro/analyze/operation.js.map +1 -1
- package/dist/browser/lro/health/operation.js +27 -34
- package/dist/browser/lro/health/operation.js.map +1 -1
- package/dist/browser/lro/poller.js +5 -7
- package/dist/browser/lro/poller.js.map +1 -1
- package/dist/browser/recognizeCategorizedEntitiesResult.js +4 -1
- package/dist/browser/recognizeCategorizedEntitiesResult.js.map +1 -1
- package/dist/browser/recognizeLinkedEntitiesResult.js +4 -1
- package/dist/browser/recognizeLinkedEntitiesResult.js.map +1 -1
- package/dist/browser/recognizePiiEntitiesResult.js +5 -2
- package/dist/browser/recognizePiiEntitiesResult.js.map +1 -1
- package/dist/browser/textAnalyticsClient.js +38 -16
- package/dist/browser/textAnalyticsClient.js.map +1 -1
- package/dist/browser/util.js +6 -8
- package/dist/browser/util.js.map +1 -1
- package/dist/commonjs/analyzeActionsResult.js +6 -7
- package/dist/commonjs/analyzeActionsResult.js.map +1 -1
- package/dist/commonjs/analyzeHealthcareEntitiesResult.js +7 -3
- package/dist/commonjs/analyzeHealthcareEntitiesResult.js.map +1 -1
- package/dist/commonjs/analyzeSentimentResult.js +7 -4
- package/dist/commonjs/analyzeSentimentResult.js.map +1 -1
- package/dist/commonjs/detectLanguageResult.js +4 -1
- package/dist/commonjs/detectLanguageResult.js.map +1 -1
- package/dist/commonjs/extractKeyPhrasesResult.js +4 -1
- package/dist/commonjs/extractKeyPhrasesResult.js.map +1 -1
- package/dist/commonjs/generated/generatedClient.js +12 -4
- package/dist/commonjs/generated/generatedClient.js.map +1 -1
- package/dist/commonjs/generated/models/mappers.js +44 -10
- package/dist/commonjs/generated/models/mappers.js.map +1 -1
- package/dist/commonjs/lro/analyze/operation.js +27 -18
- package/dist/commonjs/lro/analyze/operation.js.map +1 -1
- package/dist/commonjs/lro/health/operation.js +27 -34
- package/dist/commonjs/lro/health/operation.js.map +1 -1
- package/dist/commonjs/lro/poller.js +5 -7
- package/dist/commonjs/lro/poller.js.map +1 -1
- package/dist/commonjs/recognizeCategorizedEntitiesResult.js +4 -1
- package/dist/commonjs/recognizeCategorizedEntitiesResult.js.map +1 -1
- package/dist/commonjs/recognizeLinkedEntitiesResult.js +4 -1
- package/dist/commonjs/recognizeLinkedEntitiesResult.js.map +1 -1
- package/dist/commonjs/recognizePiiEntitiesResult.js +5 -2
- package/dist/commonjs/recognizePiiEntitiesResult.js.map +1 -1
- package/dist/commonjs/textAnalyticsClient.js +38 -16
- package/dist/commonjs/textAnalyticsClient.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/commonjs/util.js +6 -8
- package/dist/commonjs/util.js.map +1 -1
- package/dist/esm/analyzeActionsResult.js +6 -7
- package/dist/esm/analyzeActionsResult.js.map +1 -1
- package/dist/esm/analyzeHealthcareEntitiesResult.js +7 -3
- package/dist/esm/analyzeHealthcareEntitiesResult.js.map +1 -1
- package/dist/esm/analyzeSentimentResult.js +7 -4
- package/dist/esm/analyzeSentimentResult.js.map +1 -1
- package/dist/esm/detectLanguageResult.js +4 -1
- package/dist/esm/detectLanguageResult.js.map +1 -1
- package/dist/esm/extractKeyPhrasesResult.js +4 -1
- package/dist/esm/extractKeyPhrasesResult.js.map +1 -1
- package/dist/esm/generated/generatedClient.js +12 -4
- package/dist/esm/generated/generatedClient.js.map +1 -1
- package/dist/esm/generated/models/mappers.js +44 -10
- package/dist/esm/generated/models/mappers.js.map +1 -1
- package/dist/esm/lro/analyze/operation.js +27 -18
- package/dist/esm/lro/analyze/operation.js.map +1 -1
- package/dist/esm/lro/health/operation.js +27 -34
- package/dist/esm/lro/health/operation.js.map +1 -1
- package/dist/esm/lro/poller.js +5 -7
- package/dist/esm/lro/poller.js.map +1 -1
- package/dist/esm/recognizeCategorizedEntitiesResult.js +4 -1
- package/dist/esm/recognizeCategorizedEntitiesResult.js.map +1 -1
- package/dist/esm/recognizeLinkedEntitiesResult.js +4 -1
- package/dist/esm/recognizeLinkedEntitiesResult.js.map +1 -1
- package/dist/esm/recognizePiiEntitiesResult.js +5 -2
- package/dist/esm/recognizePiiEntitiesResult.js.map +1 -1
- package/dist/esm/textAnalyticsClient.js +38 -16
- package/dist/esm/textAnalyticsClient.js.map +1 -1
- package/dist/esm/util.js +6 -8
- package/dist/esm/util.js.map +1 -1
- package/dist/react-native/analyzeActionsResult.js +6 -7
- package/dist/react-native/analyzeActionsResult.js.map +1 -1
- package/dist/react-native/analyzeHealthcareEntitiesResult.js +7 -3
- package/dist/react-native/analyzeHealthcareEntitiesResult.js.map +1 -1
- package/dist/react-native/analyzeSentimentResult.js +7 -4
- package/dist/react-native/analyzeSentimentResult.js.map +1 -1
- package/dist/react-native/detectLanguageResult.js +4 -1
- package/dist/react-native/detectLanguageResult.js.map +1 -1
- package/dist/react-native/extractKeyPhrasesResult.js +4 -1
- package/dist/react-native/extractKeyPhrasesResult.js.map +1 -1
- package/dist/react-native/generated/generatedClient.js +12 -4
- package/dist/react-native/generated/generatedClient.js.map +1 -1
- package/dist/react-native/generated/models/mappers.js +44 -10
- package/dist/react-native/generated/models/mappers.js.map +1 -1
- package/dist/react-native/lro/analyze/operation.js +27 -18
- package/dist/react-native/lro/analyze/operation.js.map +1 -1
- package/dist/react-native/lro/health/operation.js +27 -34
- package/dist/react-native/lro/health/operation.js.map +1 -1
- package/dist/react-native/lro/poller.js +5 -7
- package/dist/react-native/lro/poller.js.map +1 -1
- package/dist/react-native/recognizeCategorizedEntitiesResult.js +4 -1
- package/dist/react-native/recognizeCategorizedEntitiesResult.js.map +1 -1
- package/dist/react-native/recognizeLinkedEntitiesResult.js +4 -1
- package/dist/react-native/recognizeLinkedEntitiesResult.js.map +1 -1
- package/dist/react-native/recognizePiiEntitiesResult.js +5 -2
- package/dist/react-native/recognizePiiEntitiesResult.js.map +1 -1
- package/dist/react-native/textAnalyticsClient.js +38 -16
- package/dist/react-native/textAnalyticsClient.js.map +1 -1
- package/dist/react-native/util.js +6 -8
- package/dist/react-native/util.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
5
4
|
import { isTokenCredential } from "@azure/core-auth";
|
|
6
5
|
import { SDK_VERSION } from "./constants.js";
|
|
@@ -32,6 +31,24 @@ export var PiiEntityDomain;
|
|
|
32
31
|
* Client class for interacting with Azure Text Analytics.
|
|
33
32
|
*/
|
|
34
33
|
export class TextAnalyticsClient {
|
|
34
|
+
/**
|
|
35
|
+
* The URL to the TextAnalytics endpoint
|
|
36
|
+
*/
|
|
37
|
+
endpointUrl;
|
|
38
|
+
/**
|
|
39
|
+
* The default country hint to use. Defaults to "us".
|
|
40
|
+
*/
|
|
41
|
+
defaultCountryHint;
|
|
42
|
+
/**
|
|
43
|
+
* The default language to use. Defaults to "en".
|
|
44
|
+
*/
|
|
45
|
+
defaultLanguage;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
* A reference to the auto-generated TextAnalytics HTTP client.
|
|
49
|
+
*/
|
|
50
|
+
client;
|
|
51
|
+
_tracing;
|
|
35
52
|
/**
|
|
36
53
|
* Creates an instance of TextAnalyticsClient.
|
|
37
54
|
*
|
|
@@ -47,7 +64,7 @@ export class TextAnalyticsClient {
|
|
|
47
64
|
*/
|
|
48
65
|
constructor(endpointUrl, credential, options = {}) {
|
|
49
66
|
this.endpointUrl = endpointUrl;
|
|
50
|
-
const { defaultCountryHint = "us", defaultLanguage = "en"
|
|
67
|
+
const { defaultCountryHint = "us", defaultLanguage = "en", ...pipelineOptions } = options;
|
|
51
68
|
this.defaultCountryHint = defaultCountryHint;
|
|
52
69
|
this.defaultLanguage = defaultLanguage;
|
|
53
70
|
const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;
|
|
@@ -60,12 +77,15 @@ export class TextAnalyticsClient {
|
|
|
60
77
|
else {
|
|
61
78
|
pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;
|
|
62
79
|
}
|
|
63
|
-
const internalPipelineOptions =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
const internalPipelineOptions = {
|
|
81
|
+
...pipelineOptions,
|
|
82
|
+
...{
|
|
83
|
+
loggingOptions: {
|
|
84
|
+
logger: logger.info,
|
|
85
|
+
additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
|
|
86
|
+
},
|
|
67
87
|
},
|
|
68
|
-
}
|
|
88
|
+
};
|
|
69
89
|
this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);
|
|
70
90
|
const authPolicy = isTokenCredential(credential)
|
|
71
91
|
? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })
|
|
@@ -90,7 +110,10 @@ export class TextAnalyticsClient {
|
|
|
90
110
|
}
|
|
91
111
|
else {
|
|
92
112
|
// Replace "none" hints with ""
|
|
93
|
-
realInputs = documents.map((input) => (
|
|
113
|
+
realInputs = documents.map((input) => ({
|
|
114
|
+
...input,
|
|
115
|
+
countryHint: input.countryHint === "none" ? "" : input.countryHint,
|
|
116
|
+
}));
|
|
94
117
|
realOptions = countryHintOrOptions || {};
|
|
95
118
|
}
|
|
96
119
|
return this._tracing.withSpan("TextAnalyticsClient-detectLanguages", makeGeneratedDetectLanguageOptions(realOptions), (finalOptions) => this.client
|
|
@@ -213,7 +236,7 @@ export class TextAnalyticsClient {
|
|
|
213
236
|
realInputs = documents;
|
|
214
237
|
realOptions = languageOrOptions || {};
|
|
215
238
|
}
|
|
216
|
-
const { updateIntervalInMs, resumeFrom
|
|
239
|
+
const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;
|
|
217
240
|
const poller = new BeginAnalyzeHealthcarePoller({
|
|
218
241
|
client: this.client,
|
|
219
242
|
tracing: this._tracing,
|
|
@@ -241,7 +264,7 @@ export class TextAnalyticsClient {
|
|
|
241
264
|
realOptions = languageOrOptions || {};
|
|
242
265
|
}
|
|
243
266
|
const compiledActions = compileAnalyzeInput(actions);
|
|
244
|
-
const { updateIntervalInMs, resumeFrom
|
|
267
|
+
const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;
|
|
245
268
|
const poller = new BeginAnalyzeActionsPoller({
|
|
246
269
|
client: this.client,
|
|
247
270
|
tracing: this._tracing,
|
|
@@ -259,13 +282,12 @@ export class TextAnalyticsClient {
|
|
|
259
282
|
* @internal
|
|
260
283
|
*/
|
|
261
284
|
function compileAnalyzeInput(actions) {
|
|
262
|
-
var _a, _b, _c, _d, _e;
|
|
263
285
|
return {
|
|
264
|
-
entityRecognitionPiiTasks:
|
|
265
|
-
entityRecognitionTasks:
|
|
266
|
-
keyPhraseExtractionTasks:
|
|
267
|
-
entityLinkingTasks:
|
|
268
|
-
sentimentAnalysisTasks:
|
|
286
|
+
entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask))),
|
|
287
|
+
entityRecognitionTasks: actions.recognizeEntitiesActions?.map(compose(setStrEncodingParam, addParamsToTask)),
|
|
288
|
+
keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),
|
|
289
|
+
entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(compose(setStrEncodingParam, addParamsToTask)),
|
|
290
|
+
sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask))),
|
|
269
291
|
};
|
|
270
292
|
}
|
|
271
293
|
function isStringArray(documents) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textAnalyticsClient.js","sourceRoot":"","sources":["../../src/textAnalyticsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAAE,2CAA2C,EAAE,MAAM,8CAA8C,CAAC;AAE3G,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AAEjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAEL,eAAe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,eAAe,EAAE,wBAAwB,CAAC,MAAM,CAAC,eAAe,CAAC;KAClE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\nimport type {\n DetectLanguageInput,\n JobManifestTasks as GeneratedActions,\n SentimentOptionalParams as GeneratedAnalyzeSentimentOptions,\n LanguagesOptionalParams as GeneratedDetectLanguageOptions,\n KeyPhrasesOptionalParams as GeneratedExtractKeyPhrasesOptions,\n EntitiesRecognitionGeneralOptionalParams as GeneratedRecognizeCategorizedEntitiesOptions,\n EntitiesLinkingOptionalParams as GeneratedRecognizeLinkedEntitiesOptions,\n EntitiesRecognitionPiiOptionalParams as GeneratedRecognizePiiEntitiesOptions,\n PiiCategory,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { DetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport { makeDetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport {\n StringIndexType,\n addParamsToTask,\n compose,\n setCategoriesFilter,\n setOpinionMining,\n setStrEncodingParam,\n setStrEncodingParamValue,\n throwError,\n} from \"./util.js\";\nimport {\n AnalyzeHealthcareEntitiesPollerLike,\n BeginAnalyzeHealthcarePoller,\n PollerLikeWithCancellation,\n} from \"./lro/health/poller.js\";\nimport {\n AnalyzeHealthcareOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n} from \"./lro/health/operation.js\";\nimport type { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions.js\";\nimport { AnalyzeActionsPollerLike, BeginAnalyzeActionsPoller } from \"./lro/analyze/poller.js\";\nimport {\n AnalyzeActionsOperationMetadata,\n AnalyzeActionsOperationState,\n BeginAnalyzeActionsOptions,\n} from \"./lro/analyze/operation.js\";\nimport { AnalysisPollOperationState, OperationMetadata } from \"./lro/poller.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\nexport {\n BeginAnalyzeActionsOptions,\n AnalyzeActionsPollerLike,\n AnalyzeActionsOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n PollerLikeWithCancellation,\n AnalyzeHealthcareEntitiesPollerLike,\n AnalyzeHealthcareOperationState,\n AnalysisPollOperationState,\n OperationMetadata,\n AnalyzeActionsOperationMetadata,\n StringIndexType,\n};\n\nconst DEFAULT_COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\";\n\n/**\n * Client options used to configure TextAnalytics API requests.\n */\nexport interface TextAnalyticsClientOptions extends CommonClientOptions {\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n defaultCountryHint?: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n defaultLanguage?: string;\n}\n\n/**\n * Options for the detect languages operation.\n */\nexport interface DetectLanguageOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize entities operation.\n */\nexport interface RecognizeCategorizedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for the analyze sentiment operation.\n */\nexport interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * The types of PII domains the user can choose from.\n */\nexport enum PiiEntityDomain {\n /**\n * @see {@link https://aka.ms/tanerpii} for more information.\n */\n PROTECTED_HEALTH_INFORMATION = \"PHI\",\n}\n\n/**\n * Options for the recognize PII entities operation.\n */\nexport interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n}\n\n/**\n * Options for the extract key phrases operation.\n */\nexport interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize linked entities operation.\n */\nexport interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for an entities recognition action.\n */\nexport interface RecognizeCategorizedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a Pii entities recognition action.\n */\nexport interface RecognizePiiEntitiesAction extends TextAnalyticsAction {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a key phrases recognition action.\n */\nexport interface ExtractKeyPhrasesAction extends TextAnalyticsAction {\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an entities linking action.\n */\nexport interface RecognizeLinkedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an analyze sentiment action.\n */\nexport interface AnalyzeSentimentAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n}\n\n/**\n * Description of collection of actions for the analyze API to perform on input documents. However, currently, the service can accept up to one action only per action type.\n */\nexport interface TextAnalyticsActions {\n /**\n * A collection of descriptions of entities recognition actions. However, currently, the service can accept up to one action only for `recognizeEntities`.\n */\n recognizeEntitiesActions?: RecognizeCategorizedEntitiesAction[];\n /**\n * A collection of descriptions of Pii entities recognition actions. However, currently, the service can accept up to one action only for `recognizePiiEntities`.\n */\n recognizePiiEntitiesActions?: RecognizePiiEntitiesAction[];\n /**\n * A collection of descriptions of key phrases recognition actions. However, currently, the service can accept up to one action only for `extractKeyPhrases`.\n */\n extractKeyPhrasesActions?: ExtractKeyPhrasesAction[];\n /**\n * A collection of descriptions of entities linking actions. However, currently, the service can accept up to one action only for `recognizeLinkedEntities`.\n */\n recognizeLinkedEntitiesActions?: RecognizeLinkedEntitiesAction[];\n /**\n * A collection of descriptions of sentiment analysis actions. However, currently, the service can accept up to one action only for `analyzeSentiment`.\n */\n analyzeSentimentActions?: AnalyzeSentimentAction[];\n}\n/**\n * Client class for interacting with Azure Text Analytics.\n */\nexport class TextAnalyticsClient {\n /**\n * The URL to the TextAnalytics endpoint\n */\n public readonly endpointUrl: string;\n\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n public defaultCountryHint: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n public defaultLanguage: string;\n\n /**\n * @internal\n * A reference to the auto-generated TextAnalytics HTTP client.\n */\n private readonly client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Creates an instance of TextAnalyticsClient.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateClient_KeyCredential\n * import { TextAnalyticsClient, AzureKeyCredential } from \"@azure/ai-text-analytics\";\n *\n * const client = new TextAnalyticsClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n * ```\n * @param endpointUrl - The URL to the TextAnalytics endpoint\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalyticsClientOptions = {},\n ) {\n this.endpointUrl = endpointUrl;\n const { defaultCountryHint = \"us\", defaultLanguage = \"en\", ...pipelineOptions } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;\n if (!pipelineOptions.userAgentOptions) {\n pipelineOptions.userAgentOptions = {};\n }\n if (pipelineOptions.userAgentOptions.userAgentPrefix) {\n pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n };\n\n this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-text-analytics\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input strings to analyze.\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the text analytics model in predicting\n * the language they are written in. If unspecified, this value will be\n * set to the default country hint in `TextAnalyticsClientOptions`.\n * If set to an empty string, or the string \"none\", the service will apply a\n * model where the country is explicitly unset.\n * The same country hint is applied to all strings in the input collection.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: string[],\n countryHint?: string,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input document are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: DetectLanguageInput[],\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n public async detectLanguage(\n documents: string[] | DetectLanguageInput[],\n countryHintOrOptions?: string | DetectLanguageOptions,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray> {\n let realOptions: DetectLanguageOptions;\n let realInputs: DetectLanguageInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const countryHint = (countryHintOrOptions as string) || this.defaultCountryHint;\n realInputs = convertToDetectLanguageInput(documents, countryHint);\n realOptions = options || {};\n } else {\n // Replace \"none\" hints with \"\"\n realInputs = documents.map((input) => ({\n ...input,\n countryHint: input.countryHint === \"none\" ? \"\" : input.countryHint,\n }));\n realOptions = (countryHintOrOptions as DetectLanguageOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-detectLanguages\",\n makeGeneratedDetectLanguageOptions(realOptions),\n (finalOptions) =>\n this.client\n .languages(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeDetectLanguageResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input strings, and categorize those entities into types\n * such as person, location, or organization. For more information on \n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: string[],\n language?: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input documents, and categorize those entities into types\n * such as person, location, or organization. For more information on\n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: TextDocumentInput[],\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n public async recognizeEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeCategorizedEntitiesOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray> {\n let realOptions: RecognizeCategorizedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeCategorizedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeEntities\",\n makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions),\n (finalOptions) =>\n throwError(\n this.client.entitiesRecognitionGeneral(\n {\n documents: realInputs,\n },\n finalOptions,\n ),\n ).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify the positive, negative, neutral, or mixed\n * sentiment contained in the input strings, as well as scores indicating\n * the model's confidence in each of the predicted sentiments. Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the lanuage is explicitly set to \"None\".\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: string[],\n language?: string,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n /**\n * Runs a predictive model to identify the positive, negative or neutral, or mixed\n * sentiment contained in the input documents, as well as scores indicating\n * the model's confidence in each of the predicted sentiments.Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: TextDocumentInput[],\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n public async analyzeSentiment(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | AnalyzeSentimentOptions,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray> {\n let realOptions: AnalyzeSentimentOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as AnalyzeSentimentOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-analyzeSentiment\",\n makeGeneratedAnalyzeSentimentOptions(realOptions),\n (finalOptions) =>\n this.client\n .sentiment(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeAnalyzeSentimentResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input strings.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: string[],\n language?: string,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input documents.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: TextDocumentInput[],\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n public async extractKeyPhrases(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | ExtractKeyPhrasesOptions,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray> {\n let realOptions: ExtractKeyPhrasesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as ExtractKeyPhrasesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-extractKeyPhrases\",\n makeGeneratedExtractKeyPhrasesOptions(realOptions),\n (finalOptions) =>\n this.client\n .keyPhrases(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeExtractKeyPhrasesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input strings,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizePiiEntities(\n inputs: string[],\n language?: string,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input documents,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizePiiEntities(\n inputs: TextDocumentInput[],\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n public async recognizePiiEntities(\n inputs: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizePiiEntitiesOptions,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray> {\n let realOptions: RecognizePiiEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (isStringArray(inputs)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(inputs, language);\n realOptions = options || {};\n } else {\n realInputs = inputs;\n realOptions = (languageOrOptions as RecognizePiiEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizePiiEntities\",\n makeGeneratedRecognizePiiEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesRecognitionPii(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizePiiEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input strings, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: string[],\n language?: string,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input documents, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: TextDocumentInput[],\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n public async recognizeLinkedEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeLinkedEntitiesOptions,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray> {\n let realOptions: RecognizeLinkedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeLinkedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeLinkedEntities\",\n makeGeneratedRecognizeLinkingEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesLinking(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizeLinkedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: string[],\n language?: string,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n\n async beginAnalyzeHealthcareEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | BeginAnalyzeHealthcareEntitiesOptions,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike> {\n let realOptions: BeginAnalyzeHealthcareEntitiesOptions;\n let realInputs: TextDocumentInput[];\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeHealthcareEntitiesOptions) || {};\n }\n\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeHealthcarePoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n options: restOptions,\n updateIntervalInMs: updateIntervalInMs,\n resumeFrom: resumeFrom,\n });\n\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: string[],\n actions: TextAnalyticsActions,\n language?: string,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: TextAnalyticsActions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n public async beginAnalyzeActions(\n documents: string[] | TextDocumentInput[],\n actions: TextAnalyticsActions,\n languageOrOptions?: string | BeginAnalyzeActionsOptions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike> {\n let realOptions: BeginAnalyzeActionsOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeActionsOptions) || {};\n }\n const compiledActions = compileAnalyzeInput(actions);\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeActionsPoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n actions: compiledActions,\n options: restOptions,\n resumeFrom: resumeFrom,\n updateIntervalInMs: updateIntervalInMs,\n });\n\n await poller.poll();\n return poller;\n }\n}\n\n/**\n * @internal\n */\nfunction compileAnalyzeInput(actions: TextAnalyticsActions): GeneratedActions {\n return {\n entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(\n compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask)),\n ),\n entityRecognitionTasks: actions.recognizeEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),\n entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(\n compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask)),\n ),\n };\n}\n\nfunction isStringArray(documents: any[]): documents is string[] {\n return typeof documents[0] === \"string\";\n}\n\n/**\n * @internal\n */\nfunction convertToDetectLanguageInput(\n inputs: string[],\n countryHint: string,\n): DetectLanguageInput[] {\n if (countryHint === \"none\") {\n countryHint = \"\";\n }\n return inputs.map((text: string, index): DetectLanguageInput => {\n return {\n id: String(index),\n countryHint,\n text,\n };\n });\n}\n\n/**\n * @internal\n */\nfunction convertToTextDocumentInput(inputs: string[], language: string): TextDocumentInput[] {\n return inputs.map((text: string, index): TextDocumentInput => {\n return {\n id: String(index),\n language,\n text,\n };\n });\n}\n\n/**\n * Creates the options the service expects for the analyze sentiment API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedAnalyzeSentimentOptions(\n params: AnalyzeSentimentOptions,\n): GeneratedAnalyzeSentimentOptions {\n return {\n abortSignal: params.abortSignal,\n opinionMining: params.includeOpinionMining,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize pii entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizePiiEntitiesOptions(\n params: RecognizePiiEntitiesOptions,\n): GeneratedRecognizePiiEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n domain: params.domainFilter,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n piiCategories: params.categoriesFilter,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeCategorizedEntitiesOptions(\n params: RecognizeCategorizedEntitiesOptions,\n): GeneratedRecognizeCategorizedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the detect language API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedDetectLanguageOptions(\n params: DetectLanguageOptions,\n): GeneratedDetectLanguageOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the extract key phrases API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedExtractKeyPhrasesOptions(\n params: ExtractKeyPhrasesOptions,\n): GeneratedExtractKeyPhrasesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize linked entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeLinkingEntitiesOptions(\n params: RecognizeLinkedEntitiesOptions,\n): GeneratedRecognizeLinkedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"textAnalyticsClient.js","sourceRoot":"","sources":["../../src/textAnalyticsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,E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C,WAAW;QAC/B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,aAAa,EAAE,MAAM,CAAC,kBAAkB;KACzC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,4CAA4C,CACnD,MAAsC;IAEtC,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,aAAa,EAAE,MAAM,CAAC,kBAAkB;QACxC,eAAe,EAAE,wBAAwB,CAAC,MAAM,CAAC,eAAe,CAAC;KAClE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\nimport type {\n DetectLanguageInput,\n JobManifestTasks as GeneratedActions,\n SentimentOptionalParams as GeneratedAnalyzeSentimentOptions,\n LanguagesOptionalParams as GeneratedDetectLanguageOptions,\n KeyPhrasesOptionalParams as GeneratedExtractKeyPhrasesOptions,\n EntitiesRecognitionGeneralOptionalParams as GeneratedRecognizeCategorizedEntitiesOptions,\n EntitiesLinkingOptionalParams as GeneratedRecognizeLinkedEntitiesOptions,\n EntitiesRecognitionPiiOptionalParams as GeneratedRecognizePiiEntitiesOptions,\n PiiCategory,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { DetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport { makeDetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport {\n StringIndexType,\n addParamsToTask,\n compose,\n setCategoriesFilter,\n setOpinionMining,\n setStrEncodingParam,\n setStrEncodingParamValue,\n throwError,\n} from \"./util.js\";\nimport {\n AnalyzeHealthcareEntitiesPollerLike,\n BeginAnalyzeHealthcarePoller,\n PollerLikeWithCancellation,\n} from \"./lro/health/poller.js\";\nimport {\n AnalyzeHealthcareOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n} from \"./lro/health/operation.js\";\nimport type { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions.js\";\nimport { AnalyzeActionsPollerLike, BeginAnalyzeActionsPoller } from \"./lro/analyze/poller.js\";\nimport {\n AnalyzeActionsOperationMetadata,\n AnalyzeActionsOperationState,\n BeginAnalyzeActionsOptions,\n} from \"./lro/analyze/operation.js\";\nimport { AnalysisPollOperationState, OperationMetadata } from \"./lro/poller.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\nexport {\n BeginAnalyzeActionsOptions,\n AnalyzeActionsPollerLike,\n AnalyzeActionsOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n PollerLikeWithCancellation,\n AnalyzeHealthcareEntitiesPollerLike,\n AnalyzeHealthcareOperationState,\n AnalysisPollOperationState,\n OperationMetadata,\n AnalyzeActionsOperationMetadata,\n StringIndexType,\n};\n\nconst DEFAULT_COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\";\n\n/**\n * Client options used to configure TextAnalytics API requests.\n */\nexport interface TextAnalyticsClientOptions extends CommonClientOptions {\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n defaultCountryHint?: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n defaultLanguage?: string;\n}\n\n/**\n * Options for the detect languages operation.\n */\nexport interface DetectLanguageOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize entities operation.\n */\nexport interface RecognizeCategorizedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for the analyze sentiment operation.\n */\nexport interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * The types of PII domains the user can choose from.\n */\nexport enum PiiEntityDomain {\n /**\n * @see {@link https://aka.ms/tanerpii} for more information.\n */\n PROTECTED_HEALTH_INFORMATION = \"PHI\",\n}\n\n/**\n * Options for the recognize PII entities operation.\n */\nexport interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n}\n\n/**\n * Options for the extract key phrases operation.\n */\nexport interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize linked entities operation.\n */\nexport interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for an entities recognition action.\n */\nexport interface RecognizeCategorizedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a Pii entities recognition action.\n */\nexport interface RecognizePiiEntitiesAction extends TextAnalyticsAction {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a key phrases recognition action.\n */\nexport interface ExtractKeyPhrasesAction extends TextAnalyticsAction {\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an entities linking action.\n */\nexport interface RecognizeLinkedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an analyze sentiment action.\n */\nexport interface AnalyzeSentimentAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n}\n\n/**\n * Description of collection of actions for the analyze API to perform on input documents. However, currently, the service can accept up to one action only per action type.\n */\nexport interface TextAnalyticsActions {\n /**\n * A collection of descriptions of entities recognition actions. However, currently, the service can accept up to one action only for `recognizeEntities`.\n */\n recognizeEntitiesActions?: RecognizeCategorizedEntitiesAction[];\n /**\n * A collection of descriptions of Pii entities recognition actions. However, currently, the service can accept up to one action only for `recognizePiiEntities`.\n */\n recognizePiiEntitiesActions?: RecognizePiiEntitiesAction[];\n /**\n * A collection of descriptions of key phrases recognition actions. However, currently, the service can accept up to one action only for `extractKeyPhrases`.\n */\n extractKeyPhrasesActions?: ExtractKeyPhrasesAction[];\n /**\n * A collection of descriptions of entities linking actions. However, currently, the service can accept up to one action only for `recognizeLinkedEntities`.\n */\n recognizeLinkedEntitiesActions?: RecognizeLinkedEntitiesAction[];\n /**\n * A collection of descriptions of sentiment analysis actions. However, currently, the service can accept up to one action only for `analyzeSentiment`.\n */\n analyzeSentimentActions?: AnalyzeSentimentAction[];\n}\n/**\n * Client class for interacting with Azure Text Analytics.\n */\nexport class TextAnalyticsClient {\n /**\n * The URL to the TextAnalytics endpoint\n */\n public readonly endpointUrl: string;\n\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n public defaultCountryHint: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n public defaultLanguage: string;\n\n /**\n * @internal\n * A reference to the auto-generated TextAnalytics HTTP client.\n */\n private readonly client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Creates an instance of TextAnalyticsClient.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateClient_KeyCredential\n * import { TextAnalyticsClient, AzureKeyCredential } from \"@azure/ai-text-analytics\";\n *\n * const client = new TextAnalyticsClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n * ```\n * @param endpointUrl - The URL to the TextAnalytics endpoint\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalyticsClientOptions = {},\n ) {\n this.endpointUrl = endpointUrl;\n const { defaultCountryHint = \"us\", defaultLanguage = \"en\", ...pipelineOptions } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;\n if (!pipelineOptions.userAgentOptions) {\n pipelineOptions.userAgentOptions = {};\n }\n if (pipelineOptions.userAgentOptions.userAgentPrefix) {\n pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n };\n\n this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-text-analytics\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input strings to analyze.\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the text analytics model in predicting\n * the language they are written in. If unspecified, this value will be\n * set to the default country hint in `TextAnalyticsClientOptions`.\n * If set to an empty string, or the string \"none\", the service will apply a\n * model where the country is explicitly unset.\n * The same country hint is applied to all strings in the input collection.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: string[],\n countryHint?: string,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input document are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: DetectLanguageInput[],\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n public async detectLanguage(\n documents: string[] | DetectLanguageInput[],\n countryHintOrOptions?: string | DetectLanguageOptions,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray> {\n let realOptions: DetectLanguageOptions;\n let realInputs: DetectLanguageInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const countryHint = (countryHintOrOptions as string) || this.defaultCountryHint;\n realInputs = convertToDetectLanguageInput(documents, countryHint);\n realOptions = options || {};\n } else {\n // Replace \"none\" hints with \"\"\n realInputs = documents.map((input) => ({\n ...input,\n countryHint: input.countryHint === \"none\" ? \"\" : input.countryHint,\n }));\n realOptions = (countryHintOrOptions as DetectLanguageOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-detectLanguages\",\n makeGeneratedDetectLanguageOptions(realOptions),\n (finalOptions) =>\n this.client\n .languages(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeDetectLanguageResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input strings, and categorize those entities into types\n * such as person, location, or organization. For more information on \n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: string[],\n language?: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input documents, and categorize those entities into types\n * such as person, location, or organization. For more information on\n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: TextDocumentInput[],\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n public async recognizeEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeCategorizedEntitiesOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray> {\n let realOptions: RecognizeCategorizedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeCategorizedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeEntities\",\n makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions),\n (finalOptions) =>\n throwError(\n this.client.entitiesRecognitionGeneral(\n {\n documents: realInputs,\n },\n finalOptions,\n ),\n ).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify the positive, negative, neutral, or mixed\n * sentiment contained in the input strings, as well as scores indicating\n * the model's confidence in each of the predicted sentiments. Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the lanuage is explicitly set to \"None\".\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: string[],\n language?: string,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n /**\n * Runs a predictive model to identify the positive, negative or neutral, or mixed\n * sentiment contained in the input documents, as well as scores indicating\n * the model's confidence in each of the predicted sentiments.Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: TextDocumentInput[],\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n public async analyzeSentiment(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | AnalyzeSentimentOptions,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray> {\n let realOptions: AnalyzeSentimentOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as AnalyzeSentimentOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-analyzeSentiment\",\n makeGeneratedAnalyzeSentimentOptions(realOptions),\n (finalOptions) =>\n this.client\n .sentiment(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeAnalyzeSentimentResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input strings.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: string[],\n language?: string,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input documents.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: TextDocumentInput[],\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n public async extractKeyPhrases(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | ExtractKeyPhrasesOptions,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray> {\n let realOptions: ExtractKeyPhrasesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as ExtractKeyPhrasesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-extractKeyPhrases\",\n makeGeneratedExtractKeyPhrasesOptions(realOptions),\n (finalOptions) =>\n this.client\n .keyPhrases(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeExtractKeyPhrasesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input strings,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizePiiEntities(\n inputs: string[],\n language?: string,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input documents,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizePiiEntities(\n inputs: TextDocumentInput[],\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n public async recognizePiiEntities(\n inputs: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizePiiEntitiesOptions,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray> {\n let realOptions: RecognizePiiEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (isStringArray(inputs)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(inputs, language);\n realOptions = options || {};\n } else {\n realInputs = inputs;\n realOptions = (languageOrOptions as RecognizePiiEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizePiiEntities\",\n makeGeneratedRecognizePiiEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesRecognitionPii(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizePiiEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input strings, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: string[],\n language?: string,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input documents, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: TextDocumentInput[],\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n public async recognizeLinkedEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeLinkedEntitiesOptions,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray> {\n let realOptions: RecognizeLinkedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeLinkedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeLinkedEntities\",\n makeGeneratedRecognizeLinkingEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesLinking(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizeLinkedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: string[],\n language?: string,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n\n async beginAnalyzeHealthcareEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | BeginAnalyzeHealthcareEntitiesOptions,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike> {\n let realOptions: BeginAnalyzeHealthcareEntitiesOptions;\n let realInputs: TextDocumentInput[];\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeHealthcareEntitiesOptions) || {};\n }\n\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeHealthcarePoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n options: restOptions,\n updateIntervalInMs: updateIntervalInMs,\n resumeFrom: resumeFrom,\n });\n\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: string[],\n actions: TextAnalyticsActions,\n language?: string,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: TextAnalyticsActions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n public async beginAnalyzeActions(\n documents: string[] | TextDocumentInput[],\n actions: TextAnalyticsActions,\n languageOrOptions?: string | BeginAnalyzeActionsOptions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike> {\n let realOptions: BeginAnalyzeActionsOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeActionsOptions) || {};\n }\n const compiledActions = compileAnalyzeInput(actions);\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeActionsPoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n actions: compiledActions,\n options: restOptions,\n resumeFrom: resumeFrom,\n updateIntervalInMs: updateIntervalInMs,\n });\n\n await poller.poll();\n return poller;\n }\n}\n\n/**\n * @internal\n */\nfunction compileAnalyzeInput(actions: TextAnalyticsActions): GeneratedActions {\n return {\n entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(\n compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask)),\n ),\n entityRecognitionTasks: actions.recognizeEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),\n entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(\n compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask)),\n ),\n };\n}\n\nfunction isStringArray(documents: any[]): documents is string[] {\n return typeof documents[0] === \"string\";\n}\n\n/**\n * @internal\n */\nfunction convertToDetectLanguageInput(\n inputs: string[],\n countryHint: string,\n): DetectLanguageInput[] {\n if (countryHint === \"none\") {\n countryHint = \"\";\n }\n return inputs.map((text: string, index): DetectLanguageInput => {\n return {\n id: String(index),\n countryHint,\n text,\n };\n });\n}\n\n/**\n * @internal\n */\nfunction convertToTextDocumentInput(inputs: string[], language: string): TextDocumentInput[] {\n return inputs.map((text: string, index): TextDocumentInput => {\n return {\n id: String(index),\n language,\n text,\n };\n });\n}\n\n/**\n * Creates the options the service expects for the analyze sentiment API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedAnalyzeSentimentOptions(\n params: AnalyzeSentimentOptions,\n): GeneratedAnalyzeSentimentOptions {\n return {\n abortSignal: params.abortSignal,\n opinionMining: params.includeOpinionMining,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize pii entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizePiiEntitiesOptions(\n params: RecognizePiiEntitiesOptions,\n): GeneratedRecognizePiiEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n domain: params.domainFilter,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n piiCategories: params.categoriesFilter,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeCategorizedEntitiesOptions(\n params: RecognizeCategorizedEntitiesOptions,\n): GeneratedRecognizeCategorizedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the detect language API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedDetectLanguageOptions(\n params: DetectLanguageOptions,\n): GeneratedDetectLanguageOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the extract key phrases API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedExtractKeyPhrasesOptions(\n params: ExtractKeyPhrasesOptions,\n): GeneratedExtractKeyPhrasesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize linked entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeLinkingEntitiesOptions(\n params: RecognizeLinkedEntitiesOptions,\n): GeneratedRecognizeLinkedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n };\n}\n"]}
|
package/dist/browser/util.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { RestError } from "@azure/core-rest-pipeline";
|
|
5
4
|
import { logger } from "./logger.js";
|
|
6
5
|
/**
|
|
@@ -67,7 +66,7 @@ const jsEncodingUnit = "Utf16CodeUnit";
|
|
|
67
66
|
* @internal
|
|
68
67
|
*/
|
|
69
68
|
export function addStrEncodingParam(options) {
|
|
70
|
-
return
|
|
69
|
+
return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };
|
|
71
70
|
}
|
|
72
71
|
/**
|
|
73
72
|
* Set the stringIndexType property with default if it does not exist in x.
|
|
@@ -75,7 +74,7 @@ export function addStrEncodingParam(options) {
|
|
|
75
74
|
* @internal
|
|
76
75
|
*/
|
|
77
76
|
export function setStrEncodingParam(x) {
|
|
78
|
-
return
|
|
77
|
+
return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };
|
|
79
78
|
}
|
|
80
79
|
export function setStrEncodingParamValue(stringIndexType) {
|
|
81
80
|
return stringIndexType || jsEncodingUnit;
|
|
@@ -85,20 +84,20 @@ export function setStrEncodingParamValue(stringIndexType) {
|
|
|
85
84
|
* @internal
|
|
86
85
|
*/
|
|
87
86
|
export function setOpinionMining(x) {
|
|
88
|
-
return
|
|
87
|
+
return { ...x, opinionMining: x.includeOpinionMining };
|
|
89
88
|
}
|
|
90
89
|
/**
|
|
91
90
|
* Set the pii categories property
|
|
92
91
|
* @internal
|
|
93
92
|
*/
|
|
94
93
|
export function setCategoriesFilter(x) {
|
|
95
|
-
return
|
|
94
|
+
return { ...x, piiCategories: x.categoriesFilter };
|
|
96
95
|
}
|
|
97
96
|
/**
|
|
98
97
|
* @internal
|
|
99
98
|
*/
|
|
100
99
|
export function addParamsToTask(action) {
|
|
101
|
-
const { actionName
|
|
100
|
+
const { actionName, ...params } = action;
|
|
102
101
|
return { parameters: params, taskName: actionName };
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
@@ -146,12 +145,11 @@ function appendReadableErrorMessage(currentMessage, innerMessage) {
|
|
|
146
145
|
* @param error - the incoming error
|
|
147
146
|
*/
|
|
148
147
|
function transformError(errorResponse) {
|
|
149
|
-
var _a;
|
|
150
148
|
const strongErrorResponse = errorResponse;
|
|
151
149
|
if (!strongErrorResponse.response) {
|
|
152
150
|
throw errorResponse;
|
|
153
151
|
}
|
|
154
|
-
const topLevelError =
|
|
152
|
+
const topLevelError = strongErrorResponse.response.parsedBody?.error;
|
|
155
153
|
if (!topLevelError)
|
|
156
154
|
return errorResponse;
|
|
157
155
|
let errorMessage = topLevelError.message;
|
package/dist/browser/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgBrC;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAgB,EAChB,aAAkB;IAElB,MAAM,WAAW,GAAG,IAAI,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AC,KAAK,UAAU,UAAU,CAAI,CAAa;IAC/C,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,CAAC;IACjB,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAa,GAAkB,EAAE,GAAkB;IACxE,OAAO,CAAC,KAAS,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./logger.js\";\nimport type {\n ErrorResponse,\n StringIndexType as GeneratedStringIndexType,\n InnerError,\n TextAnalyticsError,\n} from \"./generated/index.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\n/**\n * @internal\n */\ninterface IdObject {\n id: string;\n}\n\n/**\n * Given a sorted array of input objects (with a unique ID) and an unsorted array of results,\n * return a sorted array of results.\n *\n * @internal\n * @param sortedArray - An array of entries sorted by `id`\n * @param unsortedArray - An array of entries that contain `id` but are not sorted\n */\nexport function sortResponseIdObjects<T extends IdObject, U extends IdObject>(\n sortedArray: T[],\n unsortedArray: U[],\n): U[] {\n const unsortedMap = new Map<string, U>();\n for (const item of unsortedArray) {\n unsortedMap.set(item.id, item);\n }\n\n if (unsortedArray.length !== sortedArray.length) {\n const ordinal = unsortedArray.length > sortedArray.length ? \"more\" : \"fewer\";\n logger.warning(\n `The service returned ${ordinal} responses than inputs. Some errors may be treated as fatal.`,\n );\n }\n\n const result: U[] = [];\n for (const sortedItem of sortedArray) {\n const item = unsortedMap.get(sortedItem.id);\n if (item) {\n result.push(item);\n }\n }\n return result;\n}\n\n/**\n * @internal\n */\nexport interface AssessmentIndex {\n document: number;\n sentence: number;\n assessment: number;\n}\n\n/**\n * @internal\n */\nexport function parseAssessmentIndex(pointer: string): AssessmentIndex {\n const regex = new RegExp(/#\\/documents\\/(\\d+)\\/sentences\\/(\\d+)\\/assessments\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n const assessmentIndex: AssessmentIndex = {\n document: parseInt(res[1]),\n sentence: parseInt(res[2]),\n assessment: parseInt(res[3]),\n };\n return assessmentIndex;\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid Assessment pointer`);\n }\n}\n\n/**\n * Parses the index of the healthcare entity from a JSON pointer.\n * @param pointer - a JSON pointer representing an entity\n * @internal\n */\nexport function parseHealthcareEntityIndex(pointer: string): number {\n const regex = new RegExp(/#\\/results\\/documents\\/(\\d+)\\/entities\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n return parseInt(res[2]);\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid healthcare entity pointer`);\n }\n}\n\nconst jsEncodingUnit = \"Utf16CodeUnit\";\n\n/**\n * Measurement units that can used to calculate the offset and length properties.\n */\nexport type StringIndexType = \"TextElement_v8\" | \"UnicodeCodePoint\" | \"Utf16CodeUnit\";\n\n/**\n * @internal\n */\nexport function addStrEncodingParam<Options extends { stringIndexType?: StringIndexType }>(\n options: Options,\n): Options & { stringIndexType: StringIndexType } {\n return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };\n}\n\n/**\n * Set the stringIndexType property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setStrEncodingParam<X extends { stringIndexType?: GeneratedStringIndexType }>(\n x: X,\n): X & { stringIndexType: GeneratedStringIndexType } {\n return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };\n}\n\nexport function setStrEncodingParamValue(\n stringIndexType?: GeneratedStringIndexType,\n): GeneratedStringIndexType {\n return stringIndexType || jsEncodingUnit;\n}\n\n/**\n * Set the opinion mining property\n * @internal\n */\nexport function setOpinionMining<X extends { includeOpinionMining?: boolean }>(\n x: X,\n): X & { opinionMining?: boolean } {\n return { ...x, opinionMining: x.includeOpinionMining };\n}\n\n/**\n * Set the pii categories property\n * @internal\n */\nexport function setCategoriesFilter<X extends { categoriesFilter?: string[] }>(\n x: X,\n): X & { piiCategories?: string[] } {\n return { ...x, piiCategories: x.categoriesFilter };\n}\n\n/**\n * @internal\n */\nexport function addParamsToTask<X extends TextAnalyticsAction>(\n action: X,\n): { parameters?: Omit<X, \"actionName\">; taskName?: string } {\n const { actionName, ...params } = action;\n return { parameters: params, taskName: actionName };\n}\n\n/**\n * @internal\n */\ninterface PageParam {\n top: number;\n skip: number;\n}\n\n/**\n * @internal\n */\nexport function nextLinkToTopAndSkip(nextLink: string): PageParam {\n const url = new URL(nextLink);\n const searchParams = new URLSearchParams(url.searchParams);\n let top: number;\n if (searchParams.has(\"$top\")) {\n top = parseInt(searchParams.get(\"$top\")!);\n } else {\n throw new Error(`nextLink URL does not have the $top param: ${nextLink}`);\n }\n let skip: number;\n if (searchParams.has(\"$skip\")) {\n skip = parseInt(searchParams.get(\"$skip\")!);\n } else {\n throw new Error(`nextLink URL does not have the $skip param: ${nextLink}`);\n }\n return {\n skip: skip,\n top: top,\n };\n}\n\n/**\n * @internal\n */\nexport function getOperationId(operationLocation: string): string {\n const lastSlashIndex = operationLocation.lastIndexOf(\"/\");\n return operationLocation.substring(lastSlashIndex + 1);\n}\n\nfunction appendReadableErrorMessage(currentMessage: string, innerMessage: string): string {\n let message = currentMessage;\n if (message.slice(-1) !== \".\") {\n message = message + \".\";\n }\n return message + \" \" + innerMessage;\n}\n\n/**\n * @internal\n * parses incoming errors from the service/\n * @param error - the incoming error\n */\nfunction transformError(errorResponse: unknown): any {\n const strongErrorResponse = errorResponse as {\n response: {\n parsedBody?: ErrorResponse;\n };\n statusCode: number;\n };\n if (!strongErrorResponse.response) {\n throw errorResponse;\n }\n const topLevelError = strongErrorResponse.response.parsedBody?.error;\n if (!topLevelError) return errorResponse;\n let errorMessage = topLevelError.message;\n let code = topLevelError.code;\n function unwrap(error: TextAnalyticsError | InnerError): TextAnalyticsError {\n const innerError = error.innererror;\n if (innerError) {\n if (innerError.message) {\n errorMessage = appendReadableErrorMessage(errorMessage, innerError.message);\n }\n if (innerError.code) {\n code = innerError.code;\n }\n return unwrap(innerError);\n }\n return error as TextAnalyticsError;\n }\n unwrap(topLevelError);\n return new RestError(errorMessage, {\n code: code === \"InvalidDocumentBatch\" ? code : topLevelError.code,\n statusCode: strongErrorResponse.statusCode,\n });\n}\n\nexport async function throwError<T>(p: Promise<T>): Promise<T> {\n try {\n return await p;\n } catch (e: unknown) {\n throw transformError(e);\n }\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @internal\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Resolved promise\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n\n/**\n * @internal\n */\nexport function compose<T1, T2, T3>(fn1: (x: T1) => T2, fn2: (y: T2) => T3): (x: T1) => T3 {\n return (value: T1) => fn2(fn1(value));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgBrC;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAgB,EAChB,aAAkB;IAElB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAa,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,WAA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,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,CAAC;IACjB,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAa,GAAkB,EAAE,GAAkB;IACxE,OAAO,CAAC,KAAS,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./logger.js\";\nimport type {\n ErrorResponse,\n StringIndexType as GeneratedStringIndexType,\n InnerError,\n TextAnalyticsError,\n} from \"./generated/index.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\n/**\n * @internal\n */\ninterface IdObject {\n id: string;\n}\n\n/**\n * Given a sorted array of input objects (with a unique ID) and an unsorted array of results,\n * return a sorted array of results.\n *\n * @internal\n * @param sortedArray - An array of entries sorted by `id`\n * @param unsortedArray - An array of entries that contain `id` but are not sorted\n */\nexport function sortResponseIdObjects<T extends IdObject, U extends IdObject>(\n sortedArray: T[],\n unsortedArray: U[],\n): U[] {\n const unsortedMap = new Map<string, U>();\n for (const item of unsortedArray) {\n unsortedMap.set(item.id, item);\n }\n\n if (unsortedArray.length !== sortedArray.length) {\n const ordinal = unsortedArray.length > sortedArray.length ? \"more\" : \"fewer\";\n logger.warning(\n `The service returned ${ordinal} responses than inputs. Some errors may be treated as fatal.`,\n );\n }\n\n const result: U[] = [];\n for (const sortedItem of sortedArray) {\n const item = unsortedMap.get(sortedItem.id);\n if (item) {\n result.push(item);\n }\n }\n return result;\n}\n\n/**\n * @internal\n */\nexport interface AssessmentIndex {\n document: number;\n sentence: number;\n assessment: number;\n}\n\n/**\n * @internal\n */\nexport function parseAssessmentIndex(pointer: string): AssessmentIndex {\n const regex = new RegExp(/#\\/documents\\/(\\d+)\\/sentences\\/(\\d+)\\/assessments\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n const assessmentIndex: AssessmentIndex = {\n document: parseInt(res[1]),\n sentence: parseInt(res[2]),\n assessment: parseInt(res[3]),\n };\n return assessmentIndex;\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid Assessment pointer`);\n }\n}\n\n/**\n * Parses the index of the healthcare entity from a JSON pointer.\n * @param pointer - a JSON pointer representing an entity\n * @internal\n */\nexport function parseHealthcareEntityIndex(pointer: string): number {\n const regex = new RegExp(/#\\/results\\/documents\\/(\\d+)\\/entities\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n return parseInt(res[2]);\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid healthcare entity pointer`);\n }\n}\n\nconst jsEncodingUnit = \"Utf16CodeUnit\";\n\n/**\n * Measurement units that can used to calculate the offset and length properties.\n */\nexport type StringIndexType = \"TextElement_v8\" | \"UnicodeCodePoint\" | \"Utf16CodeUnit\";\n\n/**\n * @internal\n */\nexport function addStrEncodingParam<Options extends { stringIndexType?: StringIndexType }>(\n options: Options,\n): Options & { stringIndexType: StringIndexType } {\n return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };\n}\n\n/**\n * Set the stringIndexType property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setStrEncodingParam<X extends { stringIndexType?: GeneratedStringIndexType }>(\n x: X,\n): X & { stringIndexType: GeneratedStringIndexType } {\n return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };\n}\n\nexport function setStrEncodingParamValue(\n stringIndexType?: GeneratedStringIndexType,\n): GeneratedStringIndexType {\n return stringIndexType || jsEncodingUnit;\n}\n\n/**\n * Set the opinion mining property\n * @internal\n */\nexport function setOpinionMining<X extends { includeOpinionMining?: boolean }>(\n x: X,\n): X & { opinionMining?: boolean } {\n return { ...x, opinionMining: x.includeOpinionMining };\n}\n\n/**\n * Set the pii categories property\n * @internal\n */\nexport function setCategoriesFilter<X extends { categoriesFilter?: string[] }>(\n x: X,\n): X & { piiCategories?: string[] } {\n return { ...x, piiCategories: x.categoriesFilter };\n}\n\n/**\n * @internal\n */\nexport function addParamsToTask<X extends TextAnalyticsAction>(\n action: X,\n): { parameters?: Omit<X, \"actionName\">; taskName?: string } {\n const { actionName, ...params } = action;\n return { parameters: params, taskName: actionName };\n}\n\n/**\n * @internal\n */\ninterface PageParam {\n top: number;\n skip: number;\n}\n\n/**\n * @internal\n */\nexport function nextLinkToTopAndSkip(nextLink: string): PageParam {\n const url = new URL(nextLink);\n const searchParams = new URLSearchParams(url.searchParams);\n let top: number;\n if (searchParams.has(\"$top\")) {\n top = parseInt(searchParams.get(\"$top\")!);\n } else {\n throw new Error(`nextLink URL does not have the $top param: ${nextLink}`);\n }\n let skip: number;\n if (searchParams.has(\"$skip\")) {\n skip = parseInt(searchParams.get(\"$skip\")!);\n } else {\n throw new Error(`nextLink URL does not have the $skip param: ${nextLink}`);\n }\n return {\n skip: skip,\n top: top,\n };\n}\n\n/**\n * @internal\n */\nexport function getOperationId(operationLocation: string): string {\n const lastSlashIndex = operationLocation.lastIndexOf(\"/\");\n return operationLocation.substring(lastSlashIndex + 1);\n}\n\nfunction appendReadableErrorMessage(currentMessage: string, innerMessage: string): string {\n let message = currentMessage;\n if (message.slice(-1) !== \".\") {\n message = message + \".\";\n }\n return message + \" \" + innerMessage;\n}\n\n/**\n * @internal\n * parses incoming errors from the service/\n * @param error - the incoming error\n */\nfunction transformError(errorResponse: unknown): any {\n const strongErrorResponse = errorResponse as {\n response: {\n parsedBody?: ErrorResponse;\n };\n statusCode: number;\n };\n if (!strongErrorResponse.response) {\n throw errorResponse;\n }\n const topLevelError = strongErrorResponse.response.parsedBody?.error;\n if (!topLevelError) return errorResponse;\n let errorMessage = topLevelError.message;\n let code = topLevelError.code;\n function unwrap(error: TextAnalyticsError | InnerError): TextAnalyticsError {\n const innerError = error.innererror;\n if (innerError) {\n if (innerError.message) {\n errorMessage = appendReadableErrorMessage(errorMessage, innerError.message);\n }\n if (innerError.code) {\n code = innerError.code;\n }\n return unwrap(innerError);\n }\n return error as TextAnalyticsError;\n }\n unwrap(topLevelError);\n return new RestError(errorMessage, {\n code: code === \"InvalidDocumentBatch\" ? code : topLevelError.code,\n statusCode: strongErrorResponse.statusCode,\n });\n}\n\nexport async function throwError<T>(p: Promise<T>): Promise<T> {\n try {\n return await p;\n } catch (e: unknown) {\n throw transformError(e);\n }\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @internal\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Resolved promise\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n\n/**\n * @internal\n */\nexport function compose<T1, T2, T3>(fn1: (x: T1) => T2, fn2: (y: T2) => T3): (x: T1) => T3 {\n return (value: T1) => fn2(fn1(value));\n}\n"]}
|
|
@@ -143,19 +143,18 @@ function makeActionResult(documents, makeResultsArray, succeededTasks, erredActi
|
|
|
143
143
|
* @internal
|
|
144
144
|
*/
|
|
145
145
|
function createAnalyzeActionsResult(response, documents) {
|
|
146
|
-
var _a, _b, _c, _d, _e, _f;
|
|
147
146
|
const recognizeEntitiesActionErrors = [];
|
|
148
147
|
const recognizePiiEntitiesActionErrors = [];
|
|
149
148
|
const extractKeyPhrasesActionErrors = [];
|
|
150
149
|
const recognizeLinkedEntitiesActionErrors = [];
|
|
151
150
|
const analyzeSentimentActionErrors = [];
|
|
152
|
-
categorizeActionErrors(
|
|
151
|
+
categorizeActionErrors(response?.errors ?? [], recognizeEntitiesActionErrors, recognizePiiEntitiesActionErrors, extractKeyPhrasesActionErrors, recognizeLinkedEntitiesActionErrors, analyzeSentimentActionErrors);
|
|
153
152
|
return {
|
|
154
|
-
recognizeEntitiesResults: makeActionResult(documents, recognizeCategorizedEntitiesResultArray_js_1.makeRecognizeCategorizedEntitiesResultArray,
|
|
155
|
-
recognizePiiEntitiesResults: makeActionResult(documents, recognizePiiEntitiesResultArray_js_1.makeRecognizePiiEntitiesResultArray,
|
|
156
|
-
extractKeyPhrasesResults: makeActionResult(documents, extractKeyPhrasesResultArray_js_1.makeExtractKeyPhrasesResultArray,
|
|
157
|
-
recognizeLinkedEntitiesResults: makeActionResult(documents, recognizeLinkedEntitiesResultArray_js_1.makeRecognizeLinkedEntitiesResultArray,
|
|
158
|
-
analyzeSentimentResults: makeActionResult(documents, analyzeSentimentResultArray_js_1.makeAnalyzeSentimentResultArray,
|
|
153
|
+
recognizeEntitiesResults: makeActionResult(documents, recognizeCategorizedEntitiesResultArray_js_1.makeRecognizeCategorizedEntitiesResultArray, response.tasks.entityRecognitionTasks ?? [], recognizeEntitiesActionErrors),
|
|
154
|
+
recognizePiiEntitiesResults: makeActionResult(documents, recognizePiiEntitiesResultArray_js_1.makeRecognizePiiEntitiesResultArray, response.tasks.entityRecognitionPiiTasks ?? [], recognizePiiEntitiesActionErrors),
|
|
155
|
+
extractKeyPhrasesResults: makeActionResult(documents, extractKeyPhrasesResultArray_js_1.makeExtractKeyPhrasesResultArray, response.tasks.keyPhraseExtractionTasks ?? [], extractKeyPhrasesActionErrors),
|
|
156
|
+
recognizeLinkedEntitiesResults: makeActionResult(documents, recognizeLinkedEntitiesResultArray_js_1.makeRecognizeLinkedEntitiesResultArray, response.tasks.entityLinkingTasks ?? [], recognizeLinkedEntitiesActionErrors),
|
|
157
|
+
analyzeSentimentResults: makeActionResult(documents, analyzeSentimentResultArray_js_1.makeAnalyzeSentimentResultArray, response.tasks.sentimentAnalysisTasks ?? [], analyzeSentimentActionErrors),
|
|
159
158
|
};
|
|
160
159
|
}
|
|
161
160
|
//# sourceMappingURL=analyzeActionsResult.js.map
|