@azure/ai-text-analytics 5.2.0-alpha.20211130.1 → 5.2.0-alpha.20211221.2
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/README.md +1 -1
- package/dist/index.js +78 -75
- package/dist/index.js.map +1 -1
- package/dist-esm/src/analyzeActionsResult.js +15 -15
- package/dist-esm/src/analyzeActionsResult.js.map +1 -1
- package/dist-esm/src/analyzeHealthcareEntitiesResult.js +4 -4
- package/dist-esm/src/analyzeHealthcareEntitiesResult.js.map +1 -1
- package/dist-esm/src/analyzeLro.js +11 -11
- package/dist-esm/src/analyzeLro.js.map +1 -1
- package/dist-esm/src/analyzeSentimentResult.js +5 -5
- package/dist-esm/src/analyzeSentimentResult.js.map +1 -1
- package/dist-esm/src/analyzeSentimentResultArray.js +1 -1
- package/dist-esm/src/analyzeSentimentResultArray.js.map +1 -1
- package/dist-esm/src/azureKeyCredentialPolicy.js +1 -1
- package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/src/detectLanguageResult.js +1 -1
- package/dist-esm/src/detectLanguageResult.js.map +1 -1
- package/dist-esm/src/detectLanguageResultArray.js +1 -1
- package/dist-esm/src/detectLanguageResultArray.js.map +1 -1
- package/dist-esm/src/extractKeyPhrasesResult.js +1 -1
- package/dist-esm/src/extractKeyPhrasesResult.js.map +1 -1
- package/dist-esm/src/extractKeyPhrasesResultArray.js +1 -1
- package/dist-esm/src/extractKeyPhrasesResultArray.js.map +1 -1
- package/dist-esm/src/extractSummaryResult.js +1 -1
- package/dist-esm/src/extractSummaryResult.js.map +1 -1
- package/dist-esm/src/extractSummaryResultArray.js +1 -1
- package/dist-esm/src/extractSummaryResultArray.js.map +1 -1
- package/dist-esm/src/healthLro.js +12 -12
- package/dist-esm/src/healthLro.js.map +1 -1
- package/dist-esm/src/index.js +2 -2
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/multiCategoryClassifyResult.js +1 -1
- package/dist-esm/src/multiCategoryClassifyResult.js.map +1 -1
- package/dist-esm/src/multiCategoryClassifyResultArray.js +1 -1
- package/dist-esm/src/multiCategoryClassifyResultArray.js.map +1 -1
- package/dist-esm/src/recognizeCategorizedEntitiesResult.js +1 -1
- package/dist-esm/src/recognizeCategorizedEntitiesResult.js.map +1 -1
- package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js +1 -1
- package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js.map +1 -1
- package/dist-esm/src/recognizeCustomEntitiesResult.js +1 -1
- package/dist-esm/src/recognizeCustomEntitiesResult.js.map +1 -1
- package/dist-esm/src/recognizeCustomEntitiesResultArray.js +1 -1
- package/dist-esm/src/recognizeCustomEntitiesResultArray.js.map +1 -1
- package/dist-esm/src/recognizeLinkedEntitiesResult.js +1 -1
- package/dist-esm/src/recognizeLinkedEntitiesResult.js.map +1 -1
- package/dist-esm/src/recognizeLinkedEntitiesResultArray.js +1 -1
- package/dist-esm/src/recognizeLinkedEntitiesResultArray.js.map +1 -1
- package/dist-esm/src/recognizePiiEntitiesResult.js +1 -1
- package/dist-esm/src/recognizePiiEntitiesResult.js.map +1 -1
- package/dist-esm/src/recognizePiiEntitiesResultArray.js +1 -1
- package/dist-esm/src/recognizePiiEntitiesResultArray.js.map +1 -1
- package/dist-esm/src/singleCategoryClassifyResult.js +1 -1
- package/dist-esm/src/singleCategoryClassifyResult.js.map +1 -1
- package/dist-esm/src/singleCategoryClassifyResultArray.js +1 -1
- package/dist-esm/src/singleCategoryClassifyResultArray.js.map +1 -1
- package/dist-esm/src/textAnalyticsClient.js +41 -41
- package/dist-esm/src/textAnalyticsClient.js.map +1 -1
- package/dist-esm/src/textAnalyticsResult.js +5 -5
- package/dist-esm/src/textAnalyticsResult.js.map +1 -1
- package/dist-esm/src/tracing.js +1 -1
- package/dist-esm/src/tracing.js.map +1 -1
- package/dist-esm/src/util.js +9 -6
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +6 -8
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ To create a client object to access the Text Analytics API, you will need the `e
|
|
|
67
67
|
You can find the endpoint for your text analytics resource either in the [Azure Portal][azure_portal] or by using the [Azure CLI][azure_cli] snippet below:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
az cognitiveservices account show --name <your-resource-name> --resource-group <your-resource-group-name> --query "endpoint"
|
|
70
|
+
az cognitiveservices account show --name <your-resource-name> --resource-group <your-resource-group-name> --query "properties.endpoint"
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
#### Using an API Key
|
package/dist/index.js
CHANGED
|
@@ -4016,7 +4016,7 @@ const logger = logger$1.createClientLogger("ai-text-analytics");
|
|
|
4016
4016
|
*/
|
|
4017
4017
|
const createSpan = coreTracing.createSpanFunction({
|
|
4018
4018
|
packagePrefix: "Azure.CognitiveServices.TextAnalytics",
|
|
4019
|
-
namespace: "Microsoft.CognitiveServices"
|
|
4019
|
+
namespace: "Microsoft.CognitiveServices",
|
|
4020
4020
|
});
|
|
4021
4021
|
|
|
4022
4022
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -4056,7 +4056,7 @@ function parseAssessmentIndex(pointer) {
|
|
|
4056
4056
|
const assessmentIndex = {
|
|
4057
4057
|
document: parseInt(res[1]),
|
|
4058
4058
|
sentence: parseInt(res[2]),
|
|
4059
|
-
assessment: parseInt(res[3])
|
|
4059
|
+
assessment: parseInt(res[3]),
|
|
4060
4060
|
};
|
|
4061
4061
|
return assessmentIndex;
|
|
4062
4062
|
}
|
|
@@ -4140,6 +4140,9 @@ function appendReadableErrorMessage(currentMessage, innerMessage) {
|
|
|
4140
4140
|
function compileError(errorResponse) {
|
|
4141
4141
|
var _a;
|
|
4142
4142
|
const castErrorResponse = errorResponse;
|
|
4143
|
+
if (!castErrorResponse.response) {
|
|
4144
|
+
throw errorResponse;
|
|
4145
|
+
}
|
|
4143
4146
|
const topLevelError = (_a = castErrorResponse.response.parsedBody) === null || _a === void 0 ? void 0 : _a.error;
|
|
4144
4147
|
if (!topLevelError)
|
|
4145
4148
|
return errorResponse;
|
|
@@ -4158,7 +4161,7 @@ function compileError(errorResponse) {
|
|
|
4158
4161
|
unwrap(topLevelError);
|
|
4159
4162
|
return new coreRestPipeline.RestError(errorMessage, {
|
|
4160
4163
|
code: invalidDocumentBatchCode ? "InvalidDocumentBatch" : topLevelError.code,
|
|
4161
|
-
statusCode: castErrorResponse.statusCode
|
|
4164
|
+
statusCode: castErrorResponse.statusCode,
|
|
4162
4165
|
});
|
|
4163
4166
|
}
|
|
4164
4167
|
/**
|
|
@@ -4182,8 +4185,8 @@ async function getRawResponse(f, options) {
|
|
|
4182
4185
|
rawResponse: {
|
|
4183
4186
|
statusCode: rawResponse.status,
|
|
4184
4187
|
headers: rawResponse.headers.toJSON(),
|
|
4185
|
-
body: rawResponse.parsedBody
|
|
4186
|
-
}
|
|
4188
|
+
body: rawResponse.parsedBody,
|
|
4189
|
+
},
|
|
4187
4190
|
};
|
|
4188
4191
|
}
|
|
4189
4192
|
/**
|
|
@@ -4197,13 +4200,13 @@ client, spec, spanStr, options, path) {
|
|
|
4197
4200
|
const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => client.sendOperationRequest({ options: paramOptions }, Object.assign(Object.assign({}, spec), { path, httpMethod: "GET" })), finalOptions);
|
|
4198
4201
|
return {
|
|
4199
4202
|
flatResponse: flatResponse,
|
|
4200
|
-
rawResponse
|
|
4203
|
+
rawResponse,
|
|
4201
4204
|
};
|
|
4202
4205
|
}
|
|
4203
4206
|
catch (e) {
|
|
4204
4207
|
span.setStatus({
|
|
4205
4208
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
4206
|
-
message: e.message
|
|
4209
|
+
message: e.message,
|
|
4207
4210
|
});
|
|
4208
4211
|
throw e;
|
|
4209
4212
|
}
|
|
@@ -4227,7 +4230,7 @@ function intoTextAnalyticsError(errorModel) {
|
|
|
4227
4230
|
return {
|
|
4228
4231
|
code: errorModel.code,
|
|
4229
4232
|
message: errorModel.message,
|
|
4230
|
-
target: errorModel.target
|
|
4233
|
+
target: errorModel.target,
|
|
4231
4234
|
};
|
|
4232
4235
|
}
|
|
4233
4236
|
/**
|
|
@@ -4237,7 +4240,7 @@ function makeTextAnalyticsSuccessResult(id, warnings, statistics) {
|
|
|
4237
4240
|
return {
|
|
4238
4241
|
id,
|
|
4239
4242
|
statistics,
|
|
4240
|
-
warnings
|
|
4243
|
+
warnings,
|
|
4241
4244
|
};
|
|
4242
4245
|
}
|
|
4243
4246
|
/**
|
|
@@ -4246,7 +4249,7 @@ function makeTextAnalyticsSuccessResult(id, warnings, statistics) {
|
|
|
4246
4249
|
function makeTextAnalyticsErrorResult(id, error) {
|
|
4247
4250
|
return {
|
|
4248
4251
|
id,
|
|
4249
|
-
error: intoTextAnalyticsError(error)
|
|
4252
|
+
error: intoTextAnalyticsError(error),
|
|
4250
4253
|
};
|
|
4251
4254
|
}
|
|
4252
4255
|
/**
|
|
@@ -4274,7 +4277,7 @@ function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(inp
|
|
|
4274
4277
|
const sorted = processAndCombineSuccessfulAndErroneousDocuments(input, response, processSuccess, processError);
|
|
4275
4278
|
return Object.assign(sorted, {
|
|
4276
4279
|
statistics: response.statistics,
|
|
4277
|
-
modelVersion: response.modelVersion
|
|
4280
|
+
modelVersion: response.modelVersion,
|
|
4278
4281
|
});
|
|
4279
4282
|
}
|
|
4280
4283
|
/**
|
|
@@ -4290,7 +4293,7 @@ function combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInf
|
|
|
4290
4293
|
return Object.assign(sorted, {
|
|
4291
4294
|
statistics: response.statistics,
|
|
4292
4295
|
projectName: response.projectName,
|
|
4293
|
-
deploymentName: response.deploymentName
|
|
4296
|
+
deploymentName: response.deploymentName,
|
|
4294
4297
|
});
|
|
4295
4298
|
}
|
|
4296
4299
|
|
|
@@ -4346,7 +4349,7 @@ function makeRecognizeCategorizedEntitiesResultArray(input, response) {
|
|
|
4346
4349
|
* @internal
|
|
4347
4350
|
*/
|
|
4348
4351
|
function makeAnalyzeSentimentResult(result) {
|
|
4349
|
-
const { id, sentiment, confidenceScores, sentenceSentiments: sentences, warnings, statistics } = result;
|
|
4352
|
+
const { id, sentiment, confidenceScores, sentenceSentiments: sentences, warnings, statistics, } = result;
|
|
4350
4353
|
return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { sentiment,
|
|
4351
4354
|
confidenceScores, sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)) });
|
|
4352
4355
|
}
|
|
@@ -4379,13 +4382,13 @@ function convertGeneratedSentenceSentiment(sentence, result) {
|
|
|
4379
4382
|
sentiment: target.sentiment,
|
|
4380
4383
|
text: target.text,
|
|
4381
4384
|
offset: target.offset,
|
|
4382
|
-
length: target.length
|
|
4385
|
+
length: target.length,
|
|
4383
4386
|
},
|
|
4384
4387
|
assessments: target.relations
|
|
4385
4388
|
.filter((relation) => relation.relationType === "assessment")
|
|
4386
|
-
.map((relation) => convertTargetRelationToAssessmentSentiment(relation, result))
|
|
4389
|
+
.map((relation) => convertTargetRelationToAssessmentSentiment(relation, result)),
|
|
4387
4390
|
}))
|
|
4388
|
-
: []
|
|
4391
|
+
: [],
|
|
4389
4392
|
};
|
|
4390
4393
|
}
|
|
4391
4394
|
/**
|
|
@@ -4507,7 +4510,7 @@ function textAnalyticsAzureKeyCredentialPolicy(credential) {
|
|
|
4507
4510
|
sendRequest(request, next) {
|
|
4508
4511
|
request.headers.set(API_KEY_HEADER_NAME, credential.key);
|
|
4509
4512
|
return next(request);
|
|
4510
|
-
}
|
|
4513
|
+
},
|
|
4511
4514
|
};
|
|
4512
4515
|
}
|
|
4513
4516
|
|
|
@@ -4529,7 +4532,7 @@ function makeHealthcareEntitiesWithoutNeighbors(entity) {
|
|
|
4529
4532
|
text,
|
|
4530
4533
|
normalizedText: name,
|
|
4531
4534
|
subCategory: subcategory,
|
|
4532
|
-
dataSources: (_a = links === null || links === void 0 ? void 0 : links.map(({ dataSource, id }) => ({ name: dataSource, entityId: id }))) !== null && _a !== void 0 ? _a : []
|
|
4535
|
+
dataSources: (_a = links === null || links === void 0 ? void 0 : links.map(({ dataSource, id }) => ({ name: dataSource, entityId: id }))) !== null && _a !== void 0 ? _a : [],
|
|
4533
4536
|
};
|
|
4534
4537
|
}
|
|
4535
4538
|
/**
|
|
@@ -4540,8 +4543,8 @@ function makeHealthcareRelations(entities, relations) {
|
|
|
4540
4543
|
relationType: relation.relationType,
|
|
4541
4544
|
roles: relation.entities.map((role) => ({
|
|
4542
4545
|
entity: entities[parseHealthcareEntityIndex(role.ref)],
|
|
4543
|
-
name: role.role
|
|
4544
|
-
}))
|
|
4546
|
+
name: role.role,
|
|
4547
|
+
})),
|
|
4545
4548
|
}));
|
|
4546
4549
|
}
|
|
4547
4550
|
/**
|
|
@@ -4569,16 +4572,16 @@ const healthStatusOperationSpec$1 = {
|
|
|
4569
4572
|
httpMethod: "GET",
|
|
4570
4573
|
responses: {
|
|
4571
4574
|
200: {
|
|
4572
|
-
bodyMapper: HealthcareJobState
|
|
4575
|
+
bodyMapper: HealthcareJobState,
|
|
4573
4576
|
},
|
|
4574
4577
|
default: {
|
|
4575
|
-
bodyMapper: ErrorResponse
|
|
4576
|
-
}
|
|
4578
|
+
bodyMapper: ErrorResponse,
|
|
4579
|
+
},
|
|
4577
4580
|
},
|
|
4578
4581
|
queryParameters: [includeStatistics, top, skip],
|
|
4579
4582
|
urlParameters: [endpoint, apiVersion],
|
|
4580
4583
|
headerParameters: [accept],
|
|
4581
|
-
serializer: serializer$1
|
|
4584
|
+
serializer: serializer$1,
|
|
4582
4585
|
};
|
|
4583
4586
|
/**
|
|
4584
4587
|
* @internal
|
|
@@ -4601,14 +4604,14 @@ class HealthLro {
|
|
|
4601
4604
|
const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => this.client.health({ documents: this.documents }, paramOptions), finalOptions);
|
|
4602
4605
|
return {
|
|
4603
4606
|
flatResponse: flatResponse,
|
|
4604
|
-
rawResponse
|
|
4607
|
+
rawResponse,
|
|
4605
4608
|
};
|
|
4606
4609
|
}
|
|
4607
4610
|
catch (e) {
|
|
4608
4611
|
const exception = compileError(e);
|
|
4609
4612
|
span.setStatus({
|
|
4610
4613
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
4611
|
-
message: exception.message
|
|
4614
|
+
message: exception.message,
|
|
4612
4615
|
});
|
|
4613
4616
|
throw exception;
|
|
4614
4617
|
}
|
|
@@ -4664,18 +4667,18 @@ client, documents, options) {
|
|
|
4664
4667
|
if (flatResponse.results) {
|
|
4665
4668
|
return {
|
|
4666
4669
|
page: processAndCombineSuccessfulAndErroneousDocuments(documents, flatResponse.results, makeHealthcareEntitiesResult, makeHealthcareEntitiesErrorResult),
|
|
4667
|
-
nextPageLink: flatResponse.nextLink
|
|
4670
|
+
nextPageLink: flatResponse.nextLink,
|
|
4668
4671
|
};
|
|
4669
4672
|
}
|
|
4670
4673
|
else {
|
|
4671
4674
|
throw new Error("Healthcare action has succeeded but there are no results!");
|
|
4672
4675
|
}
|
|
4673
|
-
}
|
|
4676
|
+
},
|
|
4674
4677
|
};
|
|
4675
4678
|
const pagedIterator = corePaging.getPagedAsyncIterator(pagedResult);
|
|
4676
4679
|
return Object.assign(pagedIterator, {
|
|
4677
4680
|
statistics: result.results.statistics,
|
|
4678
|
-
modelVersion: result.results.modelVersion
|
|
4681
|
+
modelVersion: result.results.modelVersion,
|
|
4679
4682
|
});
|
|
4680
4683
|
};
|
|
4681
4684
|
}
|
|
@@ -4838,7 +4841,7 @@ function parseActionError(erredActions) {
|
|
|
4838
4841
|
code: erredActions.code,
|
|
4839
4842
|
message: erredActions.message,
|
|
4840
4843
|
index: parseInt(result[2]),
|
|
4841
|
-
type: convertTaskTypeToActionType(result[1])
|
|
4844
|
+
type: convertTaskTypeToActionType(result[1]),
|
|
4842
4845
|
};
|
|
4843
4846
|
}
|
|
4844
4847
|
else {
|
|
@@ -4909,7 +4912,7 @@ function createErredAction(error, lastUpdateDateTime, taskName) {
|
|
|
4909
4912
|
return {
|
|
4910
4913
|
error: intoTextAnalyticsError(error),
|
|
4911
4914
|
failedOn: lastUpdateDateTime,
|
|
4912
|
-
actionName: taskName
|
|
4915
|
+
actionName: taskName,
|
|
4913
4916
|
};
|
|
4914
4917
|
}
|
|
4915
4918
|
/**
|
|
@@ -4931,14 +4934,14 @@ function makeActionResult(documents, makeResultsArray, succeededTasks, erredActi
|
|
|
4931
4934
|
{
|
|
4932
4935
|
results: recognizeEntitiesResults,
|
|
4933
4936
|
completedOn: lastUpdateDateTime,
|
|
4934
|
-
actionName: taskName
|
|
4935
|
-
}
|
|
4937
|
+
actionName: taskName,
|
|
4938
|
+
},
|
|
4936
4939
|
];
|
|
4937
4940
|
}
|
|
4938
4941
|
else {
|
|
4939
4942
|
return [
|
|
4940
4943
|
...actions,
|
|
4941
|
-
createErredAction(erredActions[errorIndex++], lastUpdateDateTime, taskName)
|
|
4944
|
+
createErredAction(erredActions[errorIndex++], lastUpdateDateTime, taskName),
|
|
4942
4945
|
];
|
|
4943
4946
|
}
|
|
4944
4947
|
}
|
|
@@ -4972,7 +4975,7 @@ function createAnalyzeActionsResult(response, documents) {
|
|
|
4972
4975
|
extractSummaryResults: makeActionResult(documents, makeExtractSummaryResultArray, (_g = response.tasks.extractiveSummarizationTasks) !== null && _g !== void 0 ? _g : [], extractSummarySentencesActionErrors),
|
|
4973
4976
|
recognizeCustomEntitiesResults: makeActionResult(documents, makeRecognizeCustomEntitiesResultArray, (_h = response.tasks.customEntityRecognitionTasks) !== null && _h !== void 0 ? _h : [], recognizeCustomEntitiesActionErrors),
|
|
4974
4977
|
singleCategoryClassifyResults: makeActionResult(documents, makeSingleCategoryClassifyResultArray, (_j = response.tasks.customSingleClassificationTasks) !== null && _j !== void 0 ? _j : [], singleCategoryClassifyActionErrors),
|
|
4975
|
-
multiCategoryClassifyResults: makeActionResult(documents, makeMultiCategoryClassifyResultArray, (_k = response.tasks.customMultiClassificationTasks) !== null && _k !== void 0 ? _k : [], multiCategoryClassifyActionErrors)
|
|
4978
|
+
multiCategoryClassifyResults: makeActionResult(documents, makeMultiCategoryClassifyResultArray, (_k = response.tasks.customMultiClassificationTasks) !== null && _k !== void 0 ? _k : [], multiCategoryClassifyActionErrors),
|
|
4976
4979
|
};
|
|
4977
4980
|
}
|
|
4978
4981
|
|
|
@@ -4983,16 +4986,16 @@ const analyzeStatusOperationSpec$1 = {
|
|
|
4983
4986
|
httpMethod: "GET",
|
|
4984
4987
|
responses: {
|
|
4985
4988
|
200: {
|
|
4986
|
-
bodyMapper: AnalyzeJobState
|
|
4989
|
+
bodyMapper: AnalyzeJobState,
|
|
4987
4990
|
},
|
|
4988
4991
|
default: {
|
|
4989
|
-
bodyMapper: ErrorResponse
|
|
4990
|
-
}
|
|
4992
|
+
bodyMapper: ErrorResponse,
|
|
4993
|
+
},
|
|
4991
4994
|
},
|
|
4992
4995
|
queryParameters: [includeStatistics, top, skip],
|
|
4993
4996
|
urlParameters: [endpoint, apiVersion],
|
|
4994
4997
|
headerParameters: [accept],
|
|
4995
|
-
serializer: serializer$2
|
|
4998
|
+
serializer: serializer$2,
|
|
4996
4999
|
};
|
|
4997
5000
|
/**
|
|
4998
5001
|
* @internal
|
|
@@ -5016,18 +5019,18 @@ class AnalyzeLro {
|
|
|
5016
5019
|
const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => this.client.analyze(Object.assign({ body: {
|
|
5017
5020
|
analysisInput: { documents: this.documents },
|
|
5018
5021
|
tasks: this.tasks,
|
|
5019
|
-
displayName: this.initOptions.displayName
|
|
5022
|
+
displayName: this.initOptions.displayName,
|
|
5020
5023
|
} }, paramOptions)), finalOptions);
|
|
5021
5024
|
return {
|
|
5022
5025
|
flatResponse: flatResponse,
|
|
5023
|
-
rawResponse
|
|
5026
|
+
rawResponse,
|
|
5024
5027
|
};
|
|
5025
5028
|
}
|
|
5026
5029
|
catch (e) {
|
|
5027
5030
|
const exception = compileError(e);
|
|
5028
5031
|
span.setStatus({
|
|
5029
5032
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
5030
|
-
message: exception.message
|
|
5033
|
+
message: exception.message,
|
|
5031
5034
|
});
|
|
5032
5035
|
throw exception;
|
|
5033
5036
|
}
|
|
@@ -5071,9 +5074,9 @@ client, documents, options) {
|
|
|
5071
5074
|
const flatResponse = response.flatResponse;
|
|
5072
5075
|
return {
|
|
5073
5076
|
page: createAnalyzeActionsResult(flatResponse, documents),
|
|
5074
|
-
nextPageLink: flatResponse.nextLink
|
|
5077
|
+
nextPageLink: flatResponse.nextLink,
|
|
5075
5078
|
};
|
|
5076
|
-
}
|
|
5079
|
+
},
|
|
5077
5080
|
};
|
|
5078
5081
|
const pagedIterator = corePaging.getPagedAsyncIterator(pagedResult);
|
|
5079
5082
|
// Attach stats if the service starts to return them
|
|
@@ -5135,8 +5138,8 @@ class TextAnalyticsClient {
|
|
|
5135
5138
|
const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
|
|
5136
5139
|
loggingOptions: {
|
|
5137
5140
|
logger: logger.info,
|
|
5138
|
-
additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"]
|
|
5139
|
-
}
|
|
5141
|
+
additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
|
|
5142
|
+
},
|
|
5140
5143
|
});
|
|
5141
5144
|
this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);
|
|
5142
5145
|
const authPolicy = coreAuth.isTokenCredential(credential)
|
|
@@ -5163,14 +5166,14 @@ class TextAnalyticsClient {
|
|
|
5163
5166
|
const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-detectLanguages", makeGeneratedDetectLanguageOptions(realOptions));
|
|
5164
5167
|
try {
|
|
5165
5168
|
const result = await this.client.languages({
|
|
5166
|
-
documents: realInputs
|
|
5169
|
+
documents: realInputs,
|
|
5167
5170
|
}, finalOptions);
|
|
5168
5171
|
return makeDetectLanguageResultArray(realInputs, result);
|
|
5169
5172
|
}
|
|
5170
5173
|
catch (e) {
|
|
5171
5174
|
span.setStatus({
|
|
5172
5175
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
5173
|
-
message: e.message
|
|
5176
|
+
message: e.message,
|
|
5174
5177
|
});
|
|
5175
5178
|
throw e;
|
|
5176
5179
|
}
|
|
@@ -5198,7 +5201,7 @@ class TextAnalyticsClient {
|
|
|
5198
5201
|
const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-recognizeEntities", makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions));
|
|
5199
5202
|
try {
|
|
5200
5203
|
const result = await this.client.entitiesRecognitionGeneral({
|
|
5201
|
-
documents: realInputs
|
|
5204
|
+
documents: realInputs,
|
|
5202
5205
|
}, finalOptions);
|
|
5203
5206
|
return makeRecognizeCategorizedEntitiesResultArray(realInputs, result);
|
|
5204
5207
|
}
|
|
@@ -5214,7 +5217,7 @@ class TextAnalyticsClient {
|
|
|
5214
5217
|
const backwardCompatibleException = compileError(e);
|
|
5215
5218
|
span.setStatus({
|
|
5216
5219
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
5217
|
-
message: backwardCompatibleException.message
|
|
5220
|
+
message: backwardCompatibleException.message,
|
|
5218
5221
|
});
|
|
5219
5222
|
throw backwardCompatibleException;
|
|
5220
5223
|
}
|
|
@@ -5240,14 +5243,14 @@ class TextAnalyticsClient {
|
|
|
5240
5243
|
const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-analyzeSentiment", makeGeneratedAnalyzeSentimentOptions(realOptions));
|
|
5241
5244
|
try {
|
|
5242
5245
|
const result = await this.client.sentiment({
|
|
5243
|
-
documents: realInputs
|
|
5246
|
+
documents: realInputs,
|
|
5244
5247
|
}, finalOptions);
|
|
5245
5248
|
return makeAnalyzeSentimentResultArray(realInputs, result);
|
|
5246
5249
|
}
|
|
5247
5250
|
catch (e) {
|
|
5248
5251
|
span.setStatus({
|
|
5249
5252
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
5250
|
-
message: e.message
|
|
5253
|
+
message: e.message,
|
|
5251
5254
|
});
|
|
5252
5255
|
throw e;
|
|
5253
5256
|
}
|
|
@@ -5273,14 +5276,14 @@ class TextAnalyticsClient {
|
|
|
5273
5276
|
const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-extractKeyPhrases", makeGeneratedExtractKeyPhrasesOptions(realOptions));
|
|
5274
5277
|
try {
|
|
5275
5278
|
const result = await this.client.keyPhrases({
|
|
5276
|
-
documents: realInputs
|
|
5279
|
+
documents: realInputs,
|
|
5277
5280
|
}, finalOptions);
|
|
5278
5281
|
return makeExtractKeyPhrasesResultArray(realInputs, result);
|
|
5279
5282
|
}
|
|
5280
5283
|
catch (e) {
|
|
5281
5284
|
span.setStatus({
|
|
5282
5285
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
5283
|
-
message: e.message
|
|
5286
|
+
message: e.message,
|
|
5284
5287
|
});
|
|
5285
5288
|
throw e;
|
|
5286
5289
|
}
|
|
@@ -5303,14 +5306,14 @@ class TextAnalyticsClient {
|
|
|
5303
5306
|
const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-recognizePiiEntities", makeGeneratedRecognizePiiEntitiesOptions(realOptions));
|
|
5304
5307
|
try {
|
|
5305
5308
|
const result = await this.client.entitiesRecognitionPii({
|
|
5306
|
-
documents: realInputs
|
|
5309
|
+
documents: realInputs,
|
|
5307
5310
|
}, finalOptions);
|
|
5308
5311
|
return makeRecognizePiiEntitiesResultArray(realInputs, result);
|
|
5309
5312
|
}
|
|
5310
5313
|
catch (e) {
|
|
5311
5314
|
span.setStatus({
|
|
5312
5315
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
5313
|
-
message: e.message
|
|
5316
|
+
message: e.message,
|
|
5314
5317
|
});
|
|
5315
5318
|
throw e;
|
|
5316
5319
|
}
|
|
@@ -5336,14 +5339,14 @@ class TextAnalyticsClient {
|
|
|
5336
5339
|
const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-recognizeLinkedEntities", makeGeneratedRecognizeLinkingEntitiesOptions(realOptions));
|
|
5337
5340
|
try {
|
|
5338
5341
|
const result = await this.client.entitiesLinking({
|
|
5339
|
-
documents: realInputs
|
|
5342
|
+
documents: realInputs,
|
|
5340
5343
|
}, finalOptions);
|
|
5341
5344
|
return makeRecognizeLinkedEntitiesResultArray(realInputs, result);
|
|
5342
5345
|
}
|
|
5343
5346
|
catch (e) {
|
|
5344
5347
|
span.setStatus({
|
|
5345
5348
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
5346
|
-
message: e.message
|
|
5349
|
+
message: e.message,
|
|
5347
5350
|
});
|
|
5348
5351
|
throw e;
|
|
5349
5352
|
}
|
|
@@ -5363,13 +5366,13 @@ class TextAnalyticsClient {
|
|
|
5363
5366
|
realInputs = documents;
|
|
5364
5367
|
realOptions = languageOrOptions || {};
|
|
5365
5368
|
}
|
|
5366
|
-
const { updateIntervalInMs, resumeFrom, onResponse, disableServiceLogs, modelVersion, requestOptions, serializerOptions, abortSignal, stringIndexType, includeStatistics, tracingOptions } = realOptions;
|
|
5369
|
+
const { updateIntervalInMs, resumeFrom, onResponse, disableServiceLogs, modelVersion, requestOptions, serializerOptions, abortSignal, stringIndexType, includeStatistics, tracingOptions, } = realOptions;
|
|
5367
5370
|
const lro = new HealthLro(this.client, {
|
|
5368
5371
|
onResponse,
|
|
5369
5372
|
requestOptions,
|
|
5370
5373
|
serializerOptions,
|
|
5371
5374
|
abortSignal,
|
|
5372
|
-
tracingOptions
|
|
5375
|
+
tracingOptions,
|
|
5373
5376
|
}, { loggingOptOut: disableServiceLogs, stringIndexType, modelVersion }, { includeStatistics }, realInputs);
|
|
5374
5377
|
const poller = new coreLro.LroEngine(lro, {
|
|
5375
5378
|
intervalInMs: updateIntervalInMs,
|
|
@@ -5380,10 +5383,10 @@ class TextAnalyticsClient {
|
|
|
5380
5383
|
serializerOptions,
|
|
5381
5384
|
abortSignal,
|
|
5382
5385
|
tracingOptions,
|
|
5383
|
-
includeStatistics
|
|
5386
|
+
includeStatistics,
|
|
5384
5387
|
}),
|
|
5385
5388
|
isDone: isHealthDone,
|
|
5386
|
-
updateState: updateHealthState
|
|
5389
|
+
updateState: updateHealthState,
|
|
5387
5390
|
});
|
|
5388
5391
|
await poller.poll();
|
|
5389
5392
|
return poller;
|
|
@@ -5404,13 +5407,13 @@ class TextAnalyticsClient {
|
|
|
5404
5407
|
realOptions = languageOrOptions || {};
|
|
5405
5408
|
}
|
|
5406
5409
|
const compiledActions = compileAnalyzeInput(actions);
|
|
5407
|
-
const { updateIntervalInMs, resumeFrom, displayName, includeStatistics, onResponse, requestOptions, serializerOptions, abortSignal, tracingOptions } = realOptions;
|
|
5410
|
+
const { updateIntervalInMs, resumeFrom, displayName, includeStatistics, onResponse, requestOptions, serializerOptions, abortSignal, tracingOptions, } = realOptions;
|
|
5408
5411
|
const lro = new AnalyzeLro(this.client, {
|
|
5409
5412
|
onResponse,
|
|
5410
5413
|
requestOptions,
|
|
5411
5414
|
serializerOptions,
|
|
5412
5415
|
abortSignal,
|
|
5413
|
-
tracingOptions
|
|
5416
|
+
tracingOptions,
|
|
5414
5417
|
}, { displayName }, { includeStatistics }, realInputs, compiledActions);
|
|
5415
5418
|
const poller = new coreLro.LroEngine(lro, {
|
|
5416
5419
|
intervalInMs: updateIntervalInMs,
|
|
@@ -5421,10 +5424,10 @@ class TextAnalyticsClient {
|
|
|
5421
5424
|
serializerOptions,
|
|
5422
5425
|
abortSignal,
|
|
5423
5426
|
tracingOptions,
|
|
5424
|
-
includeStatistics
|
|
5427
|
+
includeStatistics,
|
|
5425
5428
|
}),
|
|
5426
5429
|
isDone: isAnalyzeDone,
|
|
5427
|
-
updateState: updateAnalyzeState
|
|
5430
|
+
updateState: updateAnalyzeState,
|
|
5428
5431
|
});
|
|
5429
5432
|
await poller.poll();
|
|
5430
5433
|
return poller;
|
|
@@ -5444,7 +5447,7 @@ function compileAnalyzeInput(actions) {
|
|
|
5444
5447
|
extractiveSummarizationTasks: (_f = actions.extractSummaryActions) === null || _f === void 0 ? void 0 : _f.map(compose(setStrEncodingParam, compose(setSentenceCount, compose(setOrderBy, addParamsToTask)))),
|
|
5445
5448
|
customEntityRecognitionTasks: (_g = actions.recognizeCustomEntitiesActions) === null || _g === void 0 ? void 0 : _g.map(compose(setStrEncodingParam, addParamsToTask)),
|
|
5446
5449
|
customSingleClassificationTasks: (_h = actions.singleCategoryClassifyActions) === null || _h === void 0 ? void 0 : _h.map(addParamsToTask),
|
|
5447
|
-
customMultiClassificationTasks: (_j = actions.multiCategoryClassifyActions) === null || _j === void 0 ? void 0 : _j.map(addParamsToTask)
|
|
5450
|
+
customMultiClassificationTasks: (_j = actions.multiCategoryClassifyActions) === null || _j === void 0 ? void 0 : _j.map(addParamsToTask),
|
|
5448
5451
|
};
|
|
5449
5452
|
}
|
|
5450
5453
|
function isStringArray(documents) {
|
|
@@ -5461,7 +5464,7 @@ function convertToDetectLanguageInput(inputs, countryHint) {
|
|
|
5461
5464
|
return {
|
|
5462
5465
|
id: String(index),
|
|
5463
5466
|
countryHint,
|
|
5464
|
-
text
|
|
5467
|
+
text,
|
|
5465
5468
|
};
|
|
5466
5469
|
});
|
|
5467
5470
|
}
|
|
@@ -5473,7 +5476,7 @@ function convertToTextDocumentInput(inputs, language) {
|
|
|
5473
5476
|
return {
|
|
5474
5477
|
id: String(index),
|
|
5475
5478
|
language,
|
|
5476
|
-
text
|
|
5479
|
+
text,
|
|
5477
5480
|
};
|
|
5478
5481
|
});
|
|
5479
5482
|
}
|
|
@@ -5493,7 +5496,7 @@ function makeGeneratedAnalyzeSentimentOptions(params) {
|
|
|
5493
5496
|
tracingOptions: params.tracingOptions,
|
|
5494
5497
|
onResponse: params.onResponse,
|
|
5495
5498
|
serializerOptions: params.serializerOptions,
|
|
5496
|
-
loggingOptOut: params.disableServiceLogs
|
|
5499
|
+
loggingOptOut: params.disableServiceLogs,
|
|
5497
5500
|
};
|
|
5498
5501
|
}
|
|
5499
5502
|
/**
|
|
@@ -5513,7 +5516,7 @@ function makeGeneratedRecognizePiiEntitiesOptions(params) {
|
|
|
5513
5516
|
piiCategories: params.categoriesFilter,
|
|
5514
5517
|
onResponse: params.onResponse,
|
|
5515
5518
|
serializerOptions: params.serializerOptions,
|
|
5516
|
-
loggingOptOut: params.disableServiceLogs
|
|
5519
|
+
loggingOptOut: params.disableServiceLogs,
|
|
5517
5520
|
};
|
|
5518
5521
|
}
|
|
5519
5522
|
/**
|
|
@@ -5531,7 +5534,7 @@ function makeGeneratedRecognizeCategorizedEntitiesOptions(params) {
|
|
|
5531
5534
|
tracingOptions: params.tracingOptions,
|
|
5532
5535
|
onResponse: params.onResponse,
|
|
5533
5536
|
serializerOptions: params.serializerOptions,
|
|
5534
|
-
loggingOptOut: params.disableServiceLogs
|
|
5537
|
+
loggingOptOut: params.disableServiceLogs,
|
|
5535
5538
|
};
|
|
5536
5539
|
}
|
|
5537
5540
|
/**
|
|
@@ -5548,7 +5551,7 @@ function makeGeneratedDetectLanguageOptions(params) {
|
|
|
5548
5551
|
tracingOptions: params.tracingOptions,
|
|
5549
5552
|
onResponse: params.onResponse,
|
|
5550
5553
|
serializerOptions: params.serializerOptions,
|
|
5551
|
-
loggingOptOut: params.disableServiceLogs
|
|
5554
|
+
loggingOptOut: params.disableServiceLogs,
|
|
5552
5555
|
};
|
|
5553
5556
|
}
|
|
5554
5557
|
/**
|
|
@@ -5565,7 +5568,7 @@ function makeGeneratedExtractKeyPhrasesOptions(params) {
|
|
|
5565
5568
|
tracingOptions: params.tracingOptions,
|
|
5566
5569
|
onResponse: params.onResponse,
|
|
5567
5570
|
serializerOptions: params.serializerOptions,
|
|
5568
|
-
loggingOptOut: params.disableServiceLogs
|
|
5571
|
+
loggingOptOut: params.disableServiceLogs,
|
|
5569
5572
|
};
|
|
5570
5573
|
}
|
|
5571
5574
|
/**
|
|
@@ -5583,7 +5586,7 @@ function makeGeneratedRecognizeLinkingEntitiesOptions(params) {
|
|
|
5583
5586
|
onResponse: params.onResponse,
|
|
5584
5587
|
serializerOptions: params.serializerOptions,
|
|
5585
5588
|
loggingOptOut: params.disableServiceLogs,
|
|
5586
|
-
stringIndexType: setStrEncodingParamValue(params.stringIndexType)
|
|
5589
|
+
stringIndexType: setStrEncodingParamValue(params.stringIndexType),
|
|
5587
5590
|
};
|
|
5588
5591
|
}
|
|
5589
5592
|
|