@azure/ai-text-analytics 5.1.1-alpha.20210730.2 → 5.1.1-alpha.20220725.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/LICENSE +1 -1
- package/README.md +14 -13
- package/dist/index.js +775 -367
- package/dist/index.js.map +1 -1
- package/dist-esm/src/analyzeActionsResult.js +9 -9
- 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/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 +2 -2
- package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/src/constants.js +7 -0
- package/dist-esm/src/constants.js.map +1 -0
- 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/generated/generatedClient.js +41 -3
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/index.js +0 -1
- package/dist-esm/src/generated/index.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +514 -1
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +5 -0
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +1 -0
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/index.js +3 -3
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/lro/analyze/operation.js +29 -71
- package/dist-esm/src/lro/analyze/operation.js.map +1 -1
- package/dist-esm/src/lro/analyze/poller.js +3 -3
- package/dist-esm/src/lro/analyze/poller.js.map +1 -1
- package/dist-esm/src/lro/health/operation.js +41 -82
- package/dist-esm/src/lro/health/operation.js.map +1 -1
- package/dist-esm/src/lro/health/poller.js +3 -3
- package/dist-esm/src/lro/health/poller.js.map +1 -1
- package/dist-esm/src/lro/poller.js +1 -1
- package/dist-esm/src/lro/poller.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/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/textAnalyticsClient.js +69 -149
- package/dist-esm/src/textAnalyticsClient.js.map +1 -1
- package/dist-esm/src/textAnalyticsResult.js +4 -14
- package/dist-esm/src/textAnalyticsResult.js.map +1 -1
- package/dist-esm/src/util.js +44 -29
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +33 -35
- package/types/ai-text-analytics.d.ts +70 -31
- package/CHANGELOG.md +0 -144
- package/dist-esm/src/generated/generatedClientContext.js +0 -42
- package/dist-esm/src/generated/generatedClientContext.js.map +0 -1
- package/dist-esm/src/tracing.js +0 -12
- package/dist-esm/src/tracing.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/health/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAyB,MAAM,WAAW,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/health/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAyB,MAAM,WAAW,CAAC;AAClE,OAAO,EAGL,qCAAqC,GACtC,MAAM,aAAa,CAAC;AAiBrB;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAGjD;IACC,wEAAwE;IACxE,YAAY,MAA+B;QACzC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAE9F,IAAI,KAAkD,CAAC;QAEvD,IAAI,UAAU,EAAE;YACd,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;SACtC;QACD,MAAM,SAAS,GAAG,IAAI,qCAAqC,CACzD,CAAC,KAAK,IAAI,EAAE,CAAQ,EACpB,MAAM,EACN,OAAO,EACP,SAAS,EACT,OAAO,CACR,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAEM,KAAK;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PollerLike } from \"@azure/core-lro\";\nimport { PagedAnalyzeHealthcareEntitiesResult } from \"../../analyzeHealthcareEntitiesResult\";\nimport { delay } from \"../../util\";\n\nimport { AnalysisPoller, AnalysisPollerOptions } from \"../poller\";\nimport {\n AnalyzeHealthcareOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n BeginAnalyzeHealthcarePollerOperation,\n} from \"./operation\";\n\n/**\n * @internal\n */\ninterface HealthcarePollerOptions extends AnalysisPollerOptions {\n readonly options?: BeginAnalyzeHealthcareEntitiesOptions;\n}\n\n/**\n * Result type of the Health Long-Running-Operation (LRO)\n */\nexport type AnalyzeHealthcareEntitiesPollerLike = PollerLike<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n>;\n\n/**\n * Class that represents a poller that waits for the healthcare results.\n * @internal\n */\nexport class BeginAnalyzeHealthcarePoller extends AnalysisPoller<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n> {\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n constructor(inputs: HealthcarePollerOptions) {\n const { client, tracing, documents, options, updateIntervalInMs = 5000, resumeFrom } = inputs;\n\n let state: AnalyzeHealthcareOperationState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n const operation = new BeginAnalyzeHealthcarePollerOperation(\n (state || {}) as any,\n client,\n tracing,\n documents,\n options\n );\n\n super(operation);\n\n this.updateIntervalInMs = updateIntervalInMs;\n }\n\n public delay(): Promise<void> {\n return delay(this.updateIntervalInMs);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../src/lro/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,
|
|
1
|
+
{"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../src/lro/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAqC,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI5E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA+ChC;;;GAGG;AACH,MAAM,OAAgB,cAAgC,SAAQ,MAAuB;IAArF;;QACE;;WAEG;QACI,uBAAkB,GAAW,IAAI,CAAC;IAQ3C,CAAC;IANC;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,qBAAqB;IAGzC,YAAmB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAcpC;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PollOperation, PollOperationState, Poller } from \"@azure/core-lro\";\nimport { TracingClient } from \"@azure/core-tracing\";\nimport { GeneratedClient } from \"../generated/generatedClient\";\nimport { State, TextDocumentInput } from \"../generated/models\";\nimport { delay } from \"../util\";\n\n/**\n * Common parameters to a Poller.\n * @internal\n */\nexport interface AnalysisPollerOptions {\n readonly client: GeneratedClient;\n readonly tracing: TracingClient;\n readonly documents: TextDocumentInput[];\n updateIntervalInMs?: number;\n resumeFrom?: string;\n}\n\n/**\n * Metadata information for an analysis poller operation.\n */\nexport interface OperationMetadata {\n /**\n * The date and time the operation was created.\n */\n createdOn: Date;\n /**\n * The date and time when the operation results will expire on the server.\n */\n expiresOn?: Date;\n /**\n * The operation id.\n */\n operationId: string;\n /**\n * The time the operation status was last updated.\n */\n lastModifiedOn: Date;\n /**\n * The current status of the operation.\n */\n status: State;\n}\n\n/**\n * An interface representing the state of an analysis poller operation.\n */\nexport interface AnalysisPollOperationState<TResult>\n extends PollOperationState<TResult>,\n OperationMetadata {}\n\n/**\n * Common properties and methods of analysis Pollers.\n * @internal\n */\nexport abstract class AnalysisPoller<TState, TResult> extends Poller<TState, TResult> {\n /**\n * Defines how much time the poller is going to wait before making a new request to the service.\n */\n public updateIntervalInMs: number = 2000;\n\n /**\n * The method used by the poller to wait before attempting to update its operation.\n */\n async delay(): Promise<void> {\n return delay(this.updateIntervalInMs);\n }\n}\n\n/**\n * Common properties and methods of polling operations.\n * @internal\n */\nexport abstract class AnalysisPollOperation<TState, TResult>\n implements PollOperation<TState, TResult>\n{\n constructor(public state: TState) {}\n\n /**\n * Meant to reach to the service and update the Poller operation.\n * @param options - The optional parameters, which is only an abortSignal from \\@azure/abort-controller\n */\n public abstract update(): Promise<PollOperation<TState, TResult>>;\n\n /**\n * Meant to reach to the service and cancel the Poller operation.\n * @param options - The optional parameters, which is only an abortSignal from \\@azure/abort-controller\n */\n public abstract cancel(): Promise<PollOperation<TState, TResult>>;\n\n /**\n * Serializes the Poller operation.\n */\n public toString(): string {\n return JSON.stringify({\n state: this.state,\n });\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { makeTextAnalyticsSuccessResult,
|
|
3
|
+
import { makeTextAnalyticsErrorResult, makeTextAnalyticsSuccessResult, } from "./textAnalyticsResult";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizeCategorizedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,
|
|
1
|
+
{"version":3,"file":"recognizeCategorizedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAGL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAgC/B;;GAEG;AACH,MAAM,UAAU,sCAAsC,CACpD,MAAwB;IAExB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IACtD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ,IACR;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2CAA2C,CACzD,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult\";\nimport { DocumentEntities, Entity, TextAnalyticsError } from \"./generated/models\";\n\n/**\n * An entity from text analysis with information about its categorical\n * classification.\n */\nexport interface CategorizedEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesResult =\n | RecognizeCategorizedEntitiesSuccessResult\n | RecognizeCategorizedEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizeCategorizedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: CategorizedEntity[];\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesResult(\n result: DocumentEntities\n): RecognizeCategorizedEntitiesSuccessResult {\n const { entities, statistics, warnings, id } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError\n): RecognizeCategorizedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { makeRecognizeCategorizedEntitiesResult,
|
|
3
|
+
import { makeRecognizeCategorizedEntitiesErrorResult, makeRecognizeCategorizedEntitiesResult, } from "./recognizeCategorizedEntitiesResult";
|
|
4
4
|
import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizeCategorizedEntitiesResultArray.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"recognizeCategorizedEntitiesResultArray.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,2CAA2C,EAC3C,sCAAsC,GACvC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAqB5G;;GAEG;AACH,MAAM,UAAU,2CAA2C,CACzD,KAA0B,EAC1B,QAAwB;IAExB,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,sCAAsC,EACtC,2CAA2C,CAC5C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EntitiesResult, TextDocumentBatchStatistics, TextDocumentInput } from \"./generated/models\";\nimport {\n RecognizeCategorizedEntitiesResult,\n makeRecognizeCategorizedEntitiesErrorResult,\n makeRecognizeCategorizedEntitiesResult,\n} from \"./recognizeCategorizedEntitiesResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `RecognizeCategorizedEntitiesResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface RecognizeCategorizedEntitiesResultArray\n extends Array<RecognizeCategorizedEntitiesResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesResultArray(\n input: TextDocumentInput[],\n response: EntitiesResult\n): RecognizeCategorizedEntitiesResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeRecognizeCategorizedEntitiesResult,\n makeRecognizeCategorizedEntitiesErrorResult\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { makeTextAnalyticsSuccessResult,
|
|
3
|
+
import { makeTextAnalyticsErrorResult, makeTextAnalyticsSuccessResult, } from "./textAnalyticsResult";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizeLinkedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeLinkedEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,
|
|
1
|
+
{"version":3,"file":"recognizeLinkedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeLinkedEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAGL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AA0B/B;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAC/C,MAA8B;IAE9B,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACtD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ,IACR;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sCAAsC,CACpD,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult\";\nimport { DocumentLinkedEntities, LinkedEntity, TextAnalyticsError } from \"./generated/models\";\n\n/**\n * The result of the recognize linked entities operation on a single document.\n */\nexport type RecognizeLinkedEntitiesResult =\n | RecognizeLinkedEntitiesSuccessResult\n | RecognizeLinkedEntitiesErrorResult;\n\n/**\n * The result of the recognize linked entities operation on a single document,\n * containing a collection of the `LinkedEntity` objects identified in that document.\n */\nexport interface RecognizeLinkedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: LinkedEntity[];\n}\n\n/**\n * An error result from the recognize linked entities operation on a single document.\n */\nexport type RecognizeLinkedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeLinkedEntitiesResult(\n result: DocumentLinkedEntities\n): RecognizeLinkedEntitiesSuccessResult {\n const { statistics, id, warnings, entities } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeLinkedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError\n): RecognizeLinkedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { makeRecognizeLinkedEntitiesResult,
|
|
3
|
+
import { makeRecognizeLinkedEntitiesErrorResult, makeRecognizeLinkedEntitiesResult, } from "./recognizeLinkedEntitiesResult";
|
|
4
4
|
import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizeLinkedEntitiesResultArray.js","sourceRoot":"","sources":["../../src/recognizeLinkedEntitiesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"recognizeLinkedEntitiesResultArray.js","sourceRoot":"","sources":["../../src/recognizeLinkedEntitiesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,sCAAsC,CACpD,KAA0B,EAC1B,QAA6B;IAE7B,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,iCAAiC,EACjC,sCAAsC,CACvC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n EntityLinkingResult,\n TextDocumentBatchStatistics,\n TextDocumentInput,\n} from \"./generated/models\";\nimport {\n RecognizeLinkedEntitiesResult,\n makeRecognizeLinkedEntitiesErrorResult,\n makeRecognizeLinkedEntitiesResult,\n} from \"./recognizeLinkedEntitiesResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `RecognizeLinkedEntitiesResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface RecognizeLinkedEntitiesResultArray extends Array<RecognizeLinkedEntitiesResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeLinkedEntitiesResultArray(\n input: TextDocumentInput[],\n response: EntityLinkingResult\n): RecognizeLinkedEntitiesResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeRecognizeLinkedEntitiesResult,\n makeRecognizeLinkedEntitiesErrorResult\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { makeTextAnalyticsSuccessResult,
|
|
3
|
+
import { makeTextAnalyticsErrorResult, makeTextAnalyticsSuccessResult, } from "./textAnalyticsResult";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizePiiEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizePiiEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,
|
|
1
|
+
{"version":3,"file":"recognizePiiEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizePiiEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAGL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAoC/B;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAA6B;IAE7B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IACtE,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ;QACR,YAAY,IACZ;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mCAAmC,CACjD,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult\";\nimport { Entity, PiiDocumentEntities, TextAnalyticsError } from \"./generated/models\";\n\n/**\n * An entity from PII recognition with information about the kind of PII\n * encountered.\n */\nexport interface PiiEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizePiiEntitiesResult =\n | RecognizePiiEntitiesSuccessResult\n | RecognizePiiEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizePiiEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: PiiEntity[];\n /**\n * The text redacted.\n */\n redactedText: string;\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizePiiEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizePiiEntitiesResult(\n document: PiiDocumentEntities\n): RecognizePiiEntitiesSuccessResult {\n const { id, entities, warnings, statistics, redactedText } = document;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n redactedText,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizePiiEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError\n): RecognizePiiEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { makeRecognizePiiEntitiesResult,
|
|
3
|
+
import { makeRecognizePiiEntitiesErrorResult, makeRecognizePiiEntitiesResult, } from "./recognizePiiEntitiesResult";
|
|
4
4
|
import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognizePiiEntitiesResultArray.js","sourceRoot":"","sources":["../../src/recognizePiiEntitiesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"recognizePiiEntitiesResultArray.js","sourceRoot":"","sources":["../../src/recognizePiiEntitiesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,mCAAmC,EACnC,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,mCAAmC,CACjD,KAA0B,EAC1B,QAAmB;IAEnB,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,8BAA8B,EAC9B,mCAAmC,CACpC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PiiResult, TextDocumentBatchStatistics, TextDocumentInput } from \"./generated/models\";\nimport {\n RecognizePiiEntitiesResult,\n makeRecognizePiiEntitiesErrorResult,\n makeRecognizePiiEntitiesResult,\n} from \"./recognizePiiEntitiesResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Collection of `RecognizePiiEntitiesResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface RecognizePiiEntitiesResultArray extends Array<RecognizePiiEntitiesResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeRecognizePiiEntitiesResultArray(\n input: TextDocumentInput[],\n response: PiiResult\n): RecognizePiiEntitiesResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeRecognizePiiEntitiesResult,\n makeRecognizePiiEntitiesErrorResult\n );\n}\n"]}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { __rest } from "tslib";
|
|
4
|
-
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
4
|
+
import { bearerTokenAuthenticationPolicy, } from "@azure/core-rest-pipeline";
|
|
5
5
|
import { isTokenCredential } from "@azure/core-auth";
|
|
6
|
+
import { SDK_VERSION } from "./constants";
|
|
6
7
|
import { GeneratedClient } from "./generated/generatedClient";
|
|
7
8
|
import { logger } from "./logger";
|
|
8
|
-
import { makeDetectLanguageResultArray } from "./detectLanguageResultArray";
|
|
9
|
-
import { makeRecognizeCategorizedEntitiesResultArray } from "./recognizeCategorizedEntitiesResultArray";
|
|
10
|
-
import { makeAnalyzeSentimentResultArray } from "./analyzeSentimentResultArray";
|
|
11
|
-
import { makeExtractKeyPhrasesResultArray } from "./extractKeyPhrasesResultArray";
|
|
12
|
-
import { makeRecognizePiiEntitiesResultArray } from "./recognizePiiEntitiesResultArray";
|
|
13
|
-
import { makeRecognizeLinkedEntitiesResultArray } from "./recognizeLinkedEntitiesResultArray";
|
|
14
|
-
import {
|
|
15
|
-
import { SpanStatusCode } from "@azure/core-tracing";
|
|
9
|
+
import { makeDetectLanguageResultArray, } from "./detectLanguageResultArray";
|
|
10
|
+
import { makeRecognizeCategorizedEntitiesResultArray, } from "./recognizeCategorizedEntitiesResultArray";
|
|
11
|
+
import { makeAnalyzeSentimentResultArray, } from "./analyzeSentimentResultArray";
|
|
12
|
+
import { makeExtractKeyPhrasesResultArray, } from "./extractKeyPhrasesResultArray";
|
|
13
|
+
import { makeRecognizePiiEntitiesResultArray, } from "./recognizePiiEntitiesResultArray";
|
|
14
|
+
import { makeRecognizeLinkedEntitiesResultArray, } from "./recognizeLinkedEntitiesResultArray";
|
|
15
|
+
import { createTracingClient } from "@azure/core-tracing";
|
|
16
16
|
import { textAnalyticsAzureKeyCredentialPolicy } from "./azureKeyCredentialPolicy";
|
|
17
|
-
import { addParamsToTask, compose,
|
|
18
|
-
import { BeginAnalyzeHealthcarePoller } from "./lro/health/poller";
|
|
17
|
+
import { addParamsToTask, compose, setCategoriesFilter, setOpinionMining, setStrEncodingParam, setStrEncodingParamValue, throwError, } from "./util";
|
|
18
|
+
import { BeginAnalyzeHealthcarePoller, } from "./lro/health/poller";
|
|
19
19
|
import { BeginAnalyzeActionsPoller } from "./lro/analyze/poller";
|
|
20
20
|
const DEFAULT_COGNITIVE_SCOPE = "https://cognitiveservices.azure.com/.default";
|
|
21
21
|
/**
|
|
@@ -53,17 +53,32 @@ export class TextAnalyticsClient {
|
|
|
53
53
|
const { defaultCountryHint = "us", defaultLanguage = "en" } = options, pipelineOptions = __rest(options, ["defaultCountryHint", "defaultLanguage"]);
|
|
54
54
|
this.defaultCountryHint = defaultCountryHint;
|
|
55
55
|
this.defaultLanguage = defaultLanguage;
|
|
56
|
+
const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;
|
|
57
|
+
if (!pipelineOptions.userAgentOptions) {
|
|
58
|
+
pipelineOptions.userAgentOptions = {};
|
|
59
|
+
}
|
|
60
|
+
if (pipelineOptions.userAgentOptions.userAgentPrefix) {
|
|
61
|
+
pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;
|
|
65
|
+
}
|
|
56
66
|
const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
|
|
57
67
|
loggingOptions: {
|
|
58
68
|
logger: logger.info,
|
|
59
|
-
additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"]
|
|
60
|
-
}
|
|
69
|
+
additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
|
|
70
|
+
},
|
|
61
71
|
});
|
|
62
72
|
this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);
|
|
63
73
|
const authPolicy = isTokenCredential(credential)
|
|
64
74
|
? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })
|
|
65
75
|
: textAnalyticsAzureKeyCredentialPolicy(credential);
|
|
66
76
|
this.client.pipeline.addPolicy(authPolicy);
|
|
77
|
+
this._tracing = createTracingClient({
|
|
78
|
+
packageName: "@azure/ai-text-analytics",
|
|
79
|
+
packageVersion: SDK_VERSION,
|
|
80
|
+
namespace: "Microsoft.CognitiveServices",
|
|
81
|
+
});
|
|
67
82
|
}
|
|
68
83
|
async detectLanguage(documents, countryHintOrOptions, options) {
|
|
69
84
|
let realOptions;
|
|
@@ -81,23 +96,11 @@ export class TextAnalyticsClient {
|
|
|
81
96
|
realInputs = documents.map((input) => (Object.assign(Object.assign({}, input), { countryHint: input.countryHint === "none" ? "" : input.countryHint })));
|
|
82
97
|
realOptions = countryHintOrOptions || {};
|
|
83
98
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return makeDetectLanguageResultArray(realInputs, result);
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
span.setStatus({
|
|
93
|
-
code: SpanStatusCode.ERROR,
|
|
94
|
-
message: e.message
|
|
95
|
-
});
|
|
96
|
-
throw e;
|
|
97
|
-
}
|
|
98
|
-
finally {
|
|
99
|
-
span.end();
|
|
100
|
-
}
|
|
99
|
+
return this._tracing.withSpan("TextAnalyticsClient-detectLanguages", makeGeneratedDetectLanguageOptions(realOptions), (finalOptions) => this.client
|
|
100
|
+
.languages({
|
|
101
|
+
documents: realInputs,
|
|
102
|
+
}, finalOptions)
|
|
103
|
+
.then((result) => makeDetectLanguageResultArray(realInputs, result)));
|
|
101
104
|
}
|
|
102
105
|
async recognizeEntities(documents, languageOrOptions,
|
|
103
106
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
@@ -116,32 +119,9 @@ export class TextAnalyticsClient {
|
|
|
116
119
|
realInputs = documents;
|
|
117
120
|
realOptions = languageOrOptions || {};
|
|
118
121
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
documents: realInputs
|
|
123
|
-
}, finalOptions);
|
|
124
|
-
return makeRecognizeCategorizedEntitiesResultArray(realInputs, result);
|
|
125
|
-
}
|
|
126
|
-
catch (e) {
|
|
127
|
-
/**
|
|
128
|
-
* This special logic handles REST exception with code
|
|
129
|
-
* InvalidDocumentBatch and is needed to maintain backward compatability
|
|
130
|
-
* with sdk v5.0.0 and earlier. In general, REST exceptions are thrown as
|
|
131
|
-
* is and include both outer and inner exception codes. However, the
|
|
132
|
-
* earlier versions were throwing an exception that included the inner
|
|
133
|
-
* code only.
|
|
134
|
-
*/
|
|
135
|
-
const backwardCompatibleException = handleInvalidDocumentBatch(e);
|
|
136
|
-
span.setStatus({
|
|
137
|
-
code: SpanStatusCode.ERROR,
|
|
138
|
-
message: backwardCompatibleException.message
|
|
139
|
-
});
|
|
140
|
-
throw backwardCompatibleException;
|
|
141
|
-
}
|
|
142
|
-
finally {
|
|
143
|
-
span.end();
|
|
144
|
-
}
|
|
122
|
+
return this._tracing.withSpan("TextAnalyticsClient-recognizeEntities", makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions), (finalOptions) => throwError(this.client.entitiesRecognitionGeneral({
|
|
123
|
+
documents: realInputs,
|
|
124
|
+
}, finalOptions)).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)));
|
|
145
125
|
}
|
|
146
126
|
async analyzeSentiment(documents, languageOrOptions, options) {
|
|
147
127
|
let realOptions;
|
|
@@ -158,23 +138,11 @@ export class TextAnalyticsClient {
|
|
|
158
138
|
realInputs = documents;
|
|
159
139
|
realOptions = languageOrOptions || {};
|
|
160
140
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return makeAnalyzeSentimentResultArray(realInputs, result);
|
|
167
|
-
}
|
|
168
|
-
catch (e) {
|
|
169
|
-
span.setStatus({
|
|
170
|
-
code: SpanStatusCode.ERROR,
|
|
171
|
-
message: e.message
|
|
172
|
-
});
|
|
173
|
-
throw e;
|
|
174
|
-
}
|
|
175
|
-
finally {
|
|
176
|
-
span.end();
|
|
177
|
-
}
|
|
141
|
+
return this._tracing.withSpan("TextAnalyticsClient-analyzeSentiment", makeGeneratedAnalyzeSentimentOptions(realOptions), (finalOptions) => this.client
|
|
142
|
+
.sentiment({
|
|
143
|
+
documents: realInputs,
|
|
144
|
+
}, finalOptions)
|
|
145
|
+
.then((result) => makeAnalyzeSentimentResultArray(realInputs, result)));
|
|
178
146
|
}
|
|
179
147
|
async extractKeyPhrases(documents, languageOrOptions, options) {
|
|
180
148
|
let realOptions;
|
|
@@ -191,23 +159,11 @@ export class TextAnalyticsClient {
|
|
|
191
159
|
realInputs = documents;
|
|
192
160
|
realOptions = languageOrOptions || {};
|
|
193
161
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return makeExtractKeyPhrasesResultArray(realInputs, result);
|
|
200
|
-
}
|
|
201
|
-
catch (e) {
|
|
202
|
-
span.setStatus({
|
|
203
|
-
code: SpanStatusCode.ERROR,
|
|
204
|
-
message: e.message
|
|
205
|
-
});
|
|
206
|
-
throw e;
|
|
207
|
-
}
|
|
208
|
-
finally {
|
|
209
|
-
span.end();
|
|
210
|
-
}
|
|
162
|
+
return this._tracing.withSpan("TextAnalyticsClient-extractKeyPhrases", makeGeneratedExtractKeyPhrasesOptions(realOptions), (finalOptions) => this.client
|
|
163
|
+
.keyPhrases({
|
|
164
|
+
documents: realInputs,
|
|
165
|
+
}, finalOptions)
|
|
166
|
+
.then((result) => makeExtractKeyPhrasesResultArray(realInputs, result)));
|
|
211
167
|
}
|
|
212
168
|
async recognizePiiEntities(inputs, languageOrOptions, options) {
|
|
213
169
|
let realOptions;
|
|
@@ -221,23 +177,11 @@ export class TextAnalyticsClient {
|
|
|
221
177
|
realInputs = inputs;
|
|
222
178
|
realOptions = languageOrOptions || {};
|
|
223
179
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return makeRecognizePiiEntitiesResultArray(realInputs, result);
|
|
230
|
-
}
|
|
231
|
-
catch (e) {
|
|
232
|
-
span.setStatus({
|
|
233
|
-
code: SpanStatusCode.ERROR,
|
|
234
|
-
message: e.message
|
|
235
|
-
});
|
|
236
|
-
throw e;
|
|
237
|
-
}
|
|
238
|
-
finally {
|
|
239
|
-
span.end();
|
|
240
|
-
}
|
|
180
|
+
return this._tracing.withSpan("TextAnalyticsClient-recognizePiiEntities", makeGeneratedRecognizePiiEntitiesOptions(realOptions), (finalOptions) => this.client
|
|
181
|
+
.entitiesRecognitionPii({
|
|
182
|
+
documents: realInputs,
|
|
183
|
+
}, finalOptions)
|
|
184
|
+
.then((result) => makeRecognizePiiEntitiesResultArray(realInputs, result)));
|
|
241
185
|
}
|
|
242
186
|
async recognizeLinkedEntities(documents, languageOrOptions, options) {
|
|
243
187
|
let realOptions;
|
|
@@ -254,23 +198,11 @@ export class TextAnalyticsClient {
|
|
|
254
198
|
realInputs = documents;
|
|
255
199
|
realOptions = languageOrOptions || {};
|
|
256
200
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return makeRecognizeLinkedEntitiesResultArray(realInputs, result);
|
|
263
|
-
}
|
|
264
|
-
catch (e) {
|
|
265
|
-
span.setStatus({
|
|
266
|
-
code: SpanStatusCode.ERROR,
|
|
267
|
-
message: e.message
|
|
268
|
-
});
|
|
269
|
-
throw e;
|
|
270
|
-
}
|
|
271
|
-
finally {
|
|
272
|
-
span.end();
|
|
273
|
-
}
|
|
201
|
+
return this._tracing.withSpan("TextAnalyticsClient-recognizeLinkedEntities", makeGeneratedRecognizeLinkingEntitiesOptions(realOptions), (finalOptions) => this.client
|
|
202
|
+
.entitiesLinking({
|
|
203
|
+
documents: realInputs,
|
|
204
|
+
}, finalOptions)
|
|
205
|
+
.then((result) => makeRecognizeLinkedEntitiesResultArray(realInputs, result)));
|
|
274
206
|
}
|
|
275
207
|
async beginAnalyzeHealthcareEntities(documents, languageOrOptions, options) {
|
|
276
208
|
let realOptions;
|
|
@@ -287,10 +219,11 @@ export class TextAnalyticsClient {
|
|
|
287
219
|
const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = __rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
|
|
288
220
|
const poller = new BeginAnalyzeHealthcarePoller({
|
|
289
221
|
client: this.client,
|
|
222
|
+
tracing: this._tracing,
|
|
290
223
|
documents: realInputs,
|
|
291
224
|
options: restOptions,
|
|
292
225
|
updateIntervalInMs: updateIntervalInMs,
|
|
293
|
-
resumeFrom: resumeFrom
|
|
226
|
+
resumeFrom: resumeFrom,
|
|
294
227
|
});
|
|
295
228
|
await poller.poll();
|
|
296
229
|
return poller;
|
|
@@ -310,34 +243,21 @@ export class TextAnalyticsClient {
|
|
|
310
243
|
realInputs = documents;
|
|
311
244
|
realOptions = languageOrOptions || {};
|
|
312
245
|
}
|
|
313
|
-
validateActions(actions);
|
|
314
246
|
const compiledActions = compileAnalyzeInput(actions);
|
|
315
247
|
const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = __rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
|
|
316
248
|
const poller = new BeginAnalyzeActionsPoller({
|
|
317
249
|
client: this.client,
|
|
250
|
+
tracing: this._tracing,
|
|
318
251
|
documents: realInputs,
|
|
319
252
|
actions: compiledActions,
|
|
320
253
|
options: restOptions,
|
|
321
254
|
resumeFrom: resumeFrom,
|
|
322
|
-
updateIntervalInMs: updateIntervalInMs
|
|
255
|
+
updateIntervalInMs: updateIntervalInMs,
|
|
323
256
|
});
|
|
324
257
|
await poller.poll();
|
|
325
258
|
return poller;
|
|
326
259
|
}
|
|
327
260
|
}
|
|
328
|
-
function validateActions(actions) {
|
|
329
|
-
function validateActionType(actionList, actionType) {
|
|
330
|
-
var _a;
|
|
331
|
-
if (((_a = actionList === null || actionList === void 0 ? void 0 : actionList.length) !== null && _a !== void 0 ? _a : 0) > 1) {
|
|
332
|
-
throw new Error(`beginAnalyzeActions: Currently, the service can accept up to one action only for ${actionType} actions.`);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
validateActionType(actions.analyzeSentimentActions, `analyzeSentiment`);
|
|
336
|
-
validateActionType(actions.extractKeyPhrasesActions, `extractKeyPhrases`);
|
|
337
|
-
validateActionType(actions.recognizeEntitiesActions, `recognizeEntities`);
|
|
338
|
-
validateActionType(actions.recognizeLinkedEntitiesActions, `recognizeLinkedEntities`);
|
|
339
|
-
validateActionType(actions.recognizePiiEntitiesActions, `recognizePiiEntities`);
|
|
340
|
-
}
|
|
341
261
|
/**
|
|
342
262
|
* @internal
|
|
343
263
|
*/
|
|
@@ -348,7 +268,7 @@ function compileAnalyzeInput(actions) {
|
|
|
348
268
|
entityRecognitionTasks: (_b = actions.recognizeEntitiesActions) === null || _b === void 0 ? void 0 : _b.map(compose(setStrEncodingParam, addParamsToTask)),
|
|
349
269
|
keyPhraseExtractionTasks: (_c = actions.extractKeyPhrasesActions) === null || _c === void 0 ? void 0 : _c.map(addParamsToTask),
|
|
350
270
|
entityLinkingTasks: (_d = actions.recognizeLinkedEntitiesActions) === null || _d === void 0 ? void 0 : _d.map(compose(setStrEncodingParam, addParamsToTask)),
|
|
351
|
-
sentimentAnalysisTasks: (_e = actions.analyzeSentimentActions) === null || _e === void 0 ? void 0 : _e.map(compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask)))
|
|
271
|
+
sentimentAnalysisTasks: (_e = actions.analyzeSentimentActions) === null || _e === void 0 ? void 0 : _e.map(compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask))),
|
|
352
272
|
};
|
|
353
273
|
}
|
|
354
274
|
function isStringArray(documents) {
|
|
@@ -365,7 +285,7 @@ function convertToDetectLanguageInput(inputs, countryHint) {
|
|
|
365
285
|
return {
|
|
366
286
|
id: String(index),
|
|
367
287
|
countryHint,
|
|
368
|
-
text
|
|
288
|
+
text,
|
|
369
289
|
};
|
|
370
290
|
});
|
|
371
291
|
}
|
|
@@ -377,7 +297,7 @@ function convertToTextDocumentInput(inputs, language) {
|
|
|
377
297
|
return {
|
|
378
298
|
id: String(index),
|
|
379
299
|
language,
|
|
380
|
-
text
|
|
300
|
+
text,
|
|
381
301
|
};
|
|
382
302
|
});
|
|
383
303
|
}
|
|
@@ -397,7 +317,7 @@ function makeGeneratedAnalyzeSentimentOptions(params) {
|
|
|
397
317
|
tracingOptions: params.tracingOptions,
|
|
398
318
|
onResponse: params.onResponse,
|
|
399
319
|
serializerOptions: params.serializerOptions,
|
|
400
|
-
loggingOptOut: params.disableServiceLogs
|
|
320
|
+
loggingOptOut: params.disableServiceLogs,
|
|
401
321
|
};
|
|
402
322
|
}
|
|
403
323
|
/**
|
|
@@ -417,7 +337,7 @@ function makeGeneratedRecognizePiiEntitiesOptions(params) {
|
|
|
417
337
|
piiCategories: params.categoriesFilter,
|
|
418
338
|
onResponse: params.onResponse,
|
|
419
339
|
serializerOptions: params.serializerOptions,
|
|
420
|
-
loggingOptOut: params.disableServiceLogs
|
|
340
|
+
loggingOptOut: params.disableServiceLogs,
|
|
421
341
|
};
|
|
422
342
|
}
|
|
423
343
|
/**
|
|
@@ -435,7 +355,7 @@ function makeGeneratedRecognizeCategorizedEntitiesOptions(params) {
|
|
|
435
355
|
tracingOptions: params.tracingOptions,
|
|
436
356
|
onResponse: params.onResponse,
|
|
437
357
|
serializerOptions: params.serializerOptions,
|
|
438
|
-
loggingOptOut: params.disableServiceLogs
|
|
358
|
+
loggingOptOut: params.disableServiceLogs,
|
|
439
359
|
};
|
|
440
360
|
}
|
|
441
361
|
/**
|
|
@@ -452,7 +372,7 @@ function makeGeneratedDetectLanguageOptions(params) {
|
|
|
452
372
|
tracingOptions: params.tracingOptions,
|
|
453
373
|
onResponse: params.onResponse,
|
|
454
374
|
serializerOptions: params.serializerOptions,
|
|
455
|
-
loggingOptOut: params.disableServiceLogs
|
|
375
|
+
loggingOptOut: params.disableServiceLogs,
|
|
456
376
|
};
|
|
457
377
|
}
|
|
458
378
|
/**
|
|
@@ -469,7 +389,7 @@ function makeGeneratedExtractKeyPhrasesOptions(params) {
|
|
|
469
389
|
tracingOptions: params.tracingOptions,
|
|
470
390
|
onResponse: params.onResponse,
|
|
471
391
|
serializerOptions: params.serializerOptions,
|
|
472
|
-
loggingOptOut: params.disableServiceLogs
|
|
392
|
+
loggingOptOut: params.disableServiceLogs,
|
|
473
393
|
};
|
|
474
394
|
}
|
|
475
395
|
/**
|
|
@@ -487,7 +407,7 @@ function makeGeneratedRecognizeLinkingEntitiesOptions(params) {
|
|
|
487
407
|
onResponse: params.onResponse,
|
|
488
408
|
serializerOptions: params.serializerOptions,
|
|
489
409
|
loggingOptOut: params.disableServiceLogs,
|
|
490
|
-
stringIndexType: setStrEncodingParamValue(params.stringIndexType)
|
|
410
|
+
stringIndexType: setStrEncodingParamValue(params.stringIndexType),
|
|
491
411
|
};
|
|
492
412
|
}
|
|
493
413
|
//# sourceMappingURL=textAnalyticsClient.js.map
|