@azure/ai-text-analytics 5.1.1-alpha.20210716.1 → 5.1.1-alpha.20220901.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 +758 -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/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 +58 -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 +34 -36
- package/types/ai-text-analytics.d.ts +133 -32
- 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;
|
|
1
|
+
{"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/health/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAyB,MAAM,WAAW,CAAC;AAClE,OAAO,EAGL,qCAAqC,GACtC,MAAM,aAAa,CAAC;AAyErB;;;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 { AbortSignalLike } from \"@azure/abort-controller\";\nimport { CancelOnProgress, PollOperationState } 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 * Abstract representation of a poller, intended to expose just the minimal API that the user needs to work with.\n */\nexport interface PollerLikeWithCancellation<TState extends PollOperationState<TResult>, TResult> {\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<void>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Stops the poller. After this, no manual or automated requests can be sent.\n */\n stopPolling(): void;\n /**\n * Returns true if the poller is stopped.\n */\n isStopped(): boolean;\n /**\n * Attempts to cancel the underlying operation.\n */\n cancelOperation(options?: { abortSignal?: AbortSignalLike }): Promise<void>;\n /**\n * Returns the state of the operation.\n * The TState defined in PollerLike can be a subset of the TState defined in\n * the Poller implementation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a serialized version of the poller's operation\n * by invoking the operation's toString method.\n */\n toString(): string;\n}\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 = PollerLikeWithCancellation<\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,22 +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
6
|
import { SDK_VERSION } from "./constants";
|
|
7
7
|
import { GeneratedClient } from "./generated/generatedClient";
|
|
8
8
|
import { logger } from "./logger";
|
|
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 {
|
|
16
|
-
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";
|
|
17
16
|
import { textAnalyticsAzureKeyCredentialPolicy } from "./azureKeyCredentialPolicy";
|
|
18
|
-
import { addParamsToTask, compose,
|
|
19
|
-
import { BeginAnalyzeHealthcarePoller } from "./lro/health/poller";
|
|
17
|
+
import { addParamsToTask, compose, setCategoriesFilter, setOpinionMining, setStrEncodingParam, setStrEncodingParamValue, throwError, } from "./util";
|
|
18
|
+
import { BeginAnalyzeHealthcarePoller, } from "./lro/health/poller";
|
|
20
19
|
import { BeginAnalyzeActionsPoller } from "./lro/analyze/poller";
|
|
21
20
|
const DEFAULT_COGNITIVE_SCOPE = "https://cognitiveservices.azure.com/.default";
|
|
22
21
|
/**
|
|
@@ -67,14 +66,19 @@ export class TextAnalyticsClient {
|
|
|
67
66
|
const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
|
|
68
67
|
loggingOptions: {
|
|
69
68
|
logger: logger.info,
|
|
70
|
-
additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"]
|
|
71
|
-
}
|
|
69
|
+
additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
|
|
70
|
+
},
|
|
72
71
|
});
|
|
73
72
|
this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);
|
|
74
73
|
const authPolicy = isTokenCredential(credential)
|
|
75
74
|
? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })
|
|
76
75
|
: textAnalyticsAzureKeyCredentialPolicy(credential);
|
|
77
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
|
+
});
|
|
78
82
|
}
|
|
79
83
|
async detectLanguage(documents, countryHintOrOptions, options) {
|
|
80
84
|
let realOptions;
|
|
@@ -92,23 +96,11 @@ export class TextAnalyticsClient {
|
|
|
92
96
|
realInputs = documents.map((input) => (Object.assign(Object.assign({}, input), { countryHint: input.countryHint === "none" ? "" : input.countryHint })));
|
|
93
97
|
realOptions = countryHintOrOptions || {};
|
|
94
98
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return makeDetectLanguageResultArray(realInputs, result);
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
span.setStatus({
|
|
104
|
-
code: SpanStatusCode.ERROR,
|
|
105
|
-
message: e.message
|
|
106
|
-
});
|
|
107
|
-
throw e;
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
span.end();
|
|
111
|
-
}
|
|
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)));
|
|
112
104
|
}
|
|
113
105
|
async recognizeEntities(documents, languageOrOptions,
|
|
114
106
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
@@ -127,32 +119,9 @@ export class TextAnalyticsClient {
|
|
|
127
119
|
realInputs = documents;
|
|
128
120
|
realOptions = languageOrOptions || {};
|
|
129
121
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
documents: realInputs
|
|
134
|
-
}, finalOptions);
|
|
135
|
-
return makeRecognizeCategorizedEntitiesResultArray(realInputs, result);
|
|
136
|
-
}
|
|
137
|
-
catch (e) {
|
|
138
|
-
/**
|
|
139
|
-
* This special logic handles REST exception with code
|
|
140
|
-
* InvalidDocumentBatch and is needed to maintain backward compatability
|
|
141
|
-
* with sdk v5.0.0 and earlier. In general, REST exceptions are thrown as
|
|
142
|
-
* is and include both outer and inner exception codes. However, the
|
|
143
|
-
* earlier versions were throwing an exception that included the inner
|
|
144
|
-
* code only.
|
|
145
|
-
*/
|
|
146
|
-
const backwardCompatibleException = handleInvalidDocumentBatch(e);
|
|
147
|
-
span.setStatus({
|
|
148
|
-
code: SpanStatusCode.ERROR,
|
|
149
|
-
message: backwardCompatibleException.message
|
|
150
|
-
});
|
|
151
|
-
throw backwardCompatibleException;
|
|
152
|
-
}
|
|
153
|
-
finally {
|
|
154
|
-
span.end();
|
|
155
|
-
}
|
|
122
|
+
return this._tracing.withSpan("TextAnalyticsClient-recognizeEntities", makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions), (finalOptions) => throwError(this.client.entitiesRecognitionGeneral({
|
|
123
|
+
documents: realInputs,
|
|
124
|
+
}, finalOptions)).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)));
|
|
156
125
|
}
|
|
157
126
|
async analyzeSentiment(documents, languageOrOptions, options) {
|
|
158
127
|
let realOptions;
|
|
@@ -169,23 +138,11 @@ export class TextAnalyticsClient {
|
|
|
169
138
|
realInputs = documents;
|
|
170
139
|
realOptions = languageOrOptions || {};
|
|
171
140
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return makeAnalyzeSentimentResultArray(realInputs, result);
|
|
178
|
-
}
|
|
179
|
-
catch (e) {
|
|
180
|
-
span.setStatus({
|
|
181
|
-
code: SpanStatusCode.ERROR,
|
|
182
|
-
message: e.message
|
|
183
|
-
});
|
|
184
|
-
throw e;
|
|
185
|
-
}
|
|
186
|
-
finally {
|
|
187
|
-
span.end();
|
|
188
|
-
}
|
|
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)));
|
|
189
146
|
}
|
|
190
147
|
async extractKeyPhrases(documents, languageOrOptions, options) {
|
|
191
148
|
let realOptions;
|
|
@@ -202,23 +159,11 @@ export class TextAnalyticsClient {
|
|
|
202
159
|
realInputs = documents;
|
|
203
160
|
realOptions = languageOrOptions || {};
|
|
204
161
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return makeExtractKeyPhrasesResultArray(realInputs, result);
|
|
211
|
-
}
|
|
212
|
-
catch (e) {
|
|
213
|
-
span.setStatus({
|
|
214
|
-
code: SpanStatusCode.ERROR,
|
|
215
|
-
message: e.message
|
|
216
|
-
});
|
|
217
|
-
throw e;
|
|
218
|
-
}
|
|
219
|
-
finally {
|
|
220
|
-
span.end();
|
|
221
|
-
}
|
|
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)));
|
|
222
167
|
}
|
|
223
168
|
async recognizePiiEntities(inputs, languageOrOptions, options) {
|
|
224
169
|
let realOptions;
|
|
@@ -232,23 +177,11 @@ export class TextAnalyticsClient {
|
|
|
232
177
|
realInputs = inputs;
|
|
233
178
|
realOptions = languageOrOptions || {};
|
|
234
179
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return makeRecognizePiiEntitiesResultArray(realInputs, result);
|
|
241
|
-
}
|
|
242
|
-
catch (e) {
|
|
243
|
-
span.setStatus({
|
|
244
|
-
code: SpanStatusCode.ERROR,
|
|
245
|
-
message: e.message
|
|
246
|
-
});
|
|
247
|
-
throw e;
|
|
248
|
-
}
|
|
249
|
-
finally {
|
|
250
|
-
span.end();
|
|
251
|
-
}
|
|
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)));
|
|
252
185
|
}
|
|
253
186
|
async recognizeLinkedEntities(documents, languageOrOptions, options) {
|
|
254
187
|
let realOptions;
|
|
@@ -265,23 +198,11 @@ export class TextAnalyticsClient {
|
|
|
265
198
|
realInputs = documents;
|
|
266
199
|
realOptions = languageOrOptions || {};
|
|
267
200
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return makeRecognizeLinkedEntitiesResultArray(realInputs, result);
|
|
274
|
-
}
|
|
275
|
-
catch (e) {
|
|
276
|
-
span.setStatus({
|
|
277
|
-
code: SpanStatusCode.ERROR,
|
|
278
|
-
message: e.message
|
|
279
|
-
});
|
|
280
|
-
throw e;
|
|
281
|
-
}
|
|
282
|
-
finally {
|
|
283
|
-
span.end();
|
|
284
|
-
}
|
|
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)));
|
|
285
206
|
}
|
|
286
207
|
async beginAnalyzeHealthcareEntities(documents, languageOrOptions, options) {
|
|
287
208
|
let realOptions;
|
|
@@ -298,10 +219,11 @@ export class TextAnalyticsClient {
|
|
|
298
219
|
const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = __rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
|
|
299
220
|
const poller = new BeginAnalyzeHealthcarePoller({
|
|
300
221
|
client: this.client,
|
|
222
|
+
tracing: this._tracing,
|
|
301
223
|
documents: realInputs,
|
|
302
224
|
options: restOptions,
|
|
303
225
|
updateIntervalInMs: updateIntervalInMs,
|
|
304
|
-
resumeFrom: resumeFrom
|
|
226
|
+
resumeFrom: resumeFrom,
|
|
305
227
|
});
|
|
306
228
|
await poller.poll();
|
|
307
229
|
return poller;
|
|
@@ -321,34 +243,21 @@ export class TextAnalyticsClient {
|
|
|
321
243
|
realInputs = documents;
|
|
322
244
|
realOptions = languageOrOptions || {};
|
|
323
245
|
}
|
|
324
|
-
validateActions(actions);
|
|
325
246
|
const compiledActions = compileAnalyzeInput(actions);
|
|
326
247
|
const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = __rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
|
|
327
248
|
const poller = new BeginAnalyzeActionsPoller({
|
|
328
249
|
client: this.client,
|
|
250
|
+
tracing: this._tracing,
|
|
329
251
|
documents: realInputs,
|
|
330
252
|
actions: compiledActions,
|
|
331
253
|
options: restOptions,
|
|
332
254
|
resumeFrom: resumeFrom,
|
|
333
|
-
updateIntervalInMs: updateIntervalInMs
|
|
255
|
+
updateIntervalInMs: updateIntervalInMs,
|
|
334
256
|
});
|
|
335
257
|
await poller.poll();
|
|
336
258
|
return poller;
|
|
337
259
|
}
|
|
338
260
|
}
|
|
339
|
-
function validateActions(actions) {
|
|
340
|
-
function validateActionType(actionList, actionType) {
|
|
341
|
-
var _a;
|
|
342
|
-
if (((_a = actionList === null || actionList === void 0 ? void 0 : actionList.length) !== null && _a !== void 0 ? _a : 0) > 1) {
|
|
343
|
-
throw new Error(`beginAnalyzeActions: Currently, the service can accept up to one action only for ${actionType} actions.`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
validateActionType(actions.analyzeSentimentActions, `analyzeSentiment`);
|
|
347
|
-
validateActionType(actions.extractKeyPhrasesActions, `extractKeyPhrases`);
|
|
348
|
-
validateActionType(actions.recognizeEntitiesActions, `recognizeEntities`);
|
|
349
|
-
validateActionType(actions.recognizeLinkedEntitiesActions, `recognizeLinkedEntities`);
|
|
350
|
-
validateActionType(actions.recognizePiiEntitiesActions, `recognizePiiEntities`);
|
|
351
|
-
}
|
|
352
261
|
/**
|
|
353
262
|
* @internal
|
|
354
263
|
*/
|
|
@@ -359,7 +268,7 @@ function compileAnalyzeInput(actions) {
|
|
|
359
268
|
entityRecognitionTasks: (_b = actions.recognizeEntitiesActions) === null || _b === void 0 ? void 0 : _b.map(compose(setStrEncodingParam, addParamsToTask)),
|
|
360
269
|
keyPhraseExtractionTasks: (_c = actions.extractKeyPhrasesActions) === null || _c === void 0 ? void 0 : _c.map(addParamsToTask),
|
|
361
270
|
entityLinkingTasks: (_d = actions.recognizeLinkedEntitiesActions) === null || _d === void 0 ? void 0 : _d.map(compose(setStrEncodingParam, addParamsToTask)),
|
|
362
|
-
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))),
|
|
363
272
|
};
|
|
364
273
|
}
|
|
365
274
|
function isStringArray(documents) {
|
|
@@ -376,7 +285,7 @@ function convertToDetectLanguageInput(inputs, countryHint) {
|
|
|
376
285
|
return {
|
|
377
286
|
id: String(index),
|
|
378
287
|
countryHint,
|
|
379
|
-
text
|
|
288
|
+
text,
|
|
380
289
|
};
|
|
381
290
|
});
|
|
382
291
|
}
|
|
@@ -388,7 +297,7 @@ function convertToTextDocumentInput(inputs, language) {
|
|
|
388
297
|
return {
|
|
389
298
|
id: String(index),
|
|
390
299
|
language,
|
|
391
|
-
text
|
|
300
|
+
text,
|
|
392
301
|
};
|
|
393
302
|
});
|
|
394
303
|
}
|
|
@@ -408,7 +317,7 @@ function makeGeneratedAnalyzeSentimentOptions(params) {
|
|
|
408
317
|
tracingOptions: params.tracingOptions,
|
|
409
318
|
onResponse: params.onResponse,
|
|
410
319
|
serializerOptions: params.serializerOptions,
|
|
411
|
-
loggingOptOut: params.disableServiceLogs
|
|
320
|
+
loggingOptOut: params.disableServiceLogs,
|
|
412
321
|
};
|
|
413
322
|
}
|
|
414
323
|
/**
|
|
@@ -428,7 +337,7 @@ function makeGeneratedRecognizePiiEntitiesOptions(params) {
|
|
|
428
337
|
piiCategories: params.categoriesFilter,
|
|
429
338
|
onResponse: params.onResponse,
|
|
430
339
|
serializerOptions: params.serializerOptions,
|
|
431
|
-
loggingOptOut: params.disableServiceLogs
|
|
340
|
+
loggingOptOut: params.disableServiceLogs,
|
|
432
341
|
};
|
|
433
342
|
}
|
|
434
343
|
/**
|
|
@@ -446,7 +355,7 @@ function makeGeneratedRecognizeCategorizedEntitiesOptions(params) {
|
|
|
446
355
|
tracingOptions: params.tracingOptions,
|
|
447
356
|
onResponse: params.onResponse,
|
|
448
357
|
serializerOptions: params.serializerOptions,
|
|
449
|
-
loggingOptOut: params.disableServiceLogs
|
|
358
|
+
loggingOptOut: params.disableServiceLogs,
|
|
450
359
|
};
|
|
451
360
|
}
|
|
452
361
|
/**
|
|
@@ -463,7 +372,7 @@ function makeGeneratedDetectLanguageOptions(params) {
|
|
|
463
372
|
tracingOptions: params.tracingOptions,
|
|
464
373
|
onResponse: params.onResponse,
|
|
465
374
|
serializerOptions: params.serializerOptions,
|
|
466
|
-
loggingOptOut: params.disableServiceLogs
|
|
375
|
+
loggingOptOut: params.disableServiceLogs,
|
|
467
376
|
};
|
|
468
377
|
}
|
|
469
378
|
/**
|
|
@@ -480,7 +389,7 @@ function makeGeneratedExtractKeyPhrasesOptions(params) {
|
|
|
480
389
|
tracingOptions: params.tracingOptions,
|
|
481
390
|
onResponse: params.onResponse,
|
|
482
391
|
serializerOptions: params.serializerOptions,
|
|
483
|
-
loggingOptOut: params.disableServiceLogs
|
|
392
|
+
loggingOptOut: params.disableServiceLogs,
|
|
484
393
|
};
|
|
485
394
|
}
|
|
486
395
|
/**
|
|
@@ -498,7 +407,7 @@ function makeGeneratedRecognizeLinkingEntitiesOptions(params) {
|
|
|
498
407
|
onResponse: params.onResponse,
|
|
499
408
|
serializerOptions: params.serializerOptions,
|
|
500
409
|
loggingOptOut: params.disableServiceLogs,
|
|
501
|
-
stringIndexType: setStrEncodingParamValue(params.stringIndexType)
|
|
410
|
+
stringIndexType: setStrEncodingParamValue(params.stringIndexType),
|
|
502
411
|
};
|
|
503
412
|
}
|
|
504
413
|
//# sourceMappingURL=textAnalyticsClient.js.map
|