@azure/ai-text-analytics 5.1.1-alpha.20250109.1 → 5.1.1-alpha.20250110.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.
Files changed (30) hide show
  1. package/README.md +9 -9
  2. package/dist/browser/analyzeSentimentResult.d.ts +1 -1
  3. package/dist/browser/analyzeSentimentResult.js.map +1 -1
  4. package/dist/browser/lro/health/operation.js.map +1 -1
  5. package/dist/browser/textAnalyticsClient.d.ts +14 -14
  6. package/dist/browser/textAnalyticsClient.js.map +1 -1
  7. package/dist/browser/textAnalyticsOperationOptions.d.ts +1 -1
  8. package/dist/browser/textAnalyticsOperationOptions.js.map +1 -1
  9. package/dist/commonjs/analyzeSentimentResult.d.ts +1 -1
  10. package/dist/commonjs/analyzeSentimentResult.js.map +1 -1
  11. package/dist/commonjs/lro/health/operation.js.map +1 -1
  12. package/dist/commonjs/textAnalyticsClient.d.ts +14 -14
  13. package/dist/commonjs/textAnalyticsClient.js.map +1 -1
  14. package/dist/commonjs/textAnalyticsOperationOptions.d.ts +1 -1
  15. package/dist/commonjs/textAnalyticsOperationOptions.js.map +1 -1
  16. package/dist/esm/analyzeSentimentResult.d.ts +1 -1
  17. package/dist/esm/analyzeSentimentResult.js.map +1 -1
  18. package/dist/esm/lro/health/operation.js.map +1 -1
  19. package/dist/esm/textAnalyticsClient.d.ts +14 -14
  20. package/dist/esm/textAnalyticsClient.js.map +1 -1
  21. package/dist/esm/textAnalyticsOperationOptions.d.ts +1 -1
  22. package/dist/esm/textAnalyticsOperationOptions.js.map +1 -1
  23. package/dist/react-native/analyzeSentimentResult.d.ts +1 -1
  24. package/dist/react-native/analyzeSentimentResult.js.map +1 -1
  25. package/dist/react-native/lro/health/operation.js.map +1 -1
  26. package/dist/react-native/textAnalyticsClient.d.ts +14 -14
  27. package/dist/react-native/textAnalyticsClient.js.map +1 -1
  28. package/dist/react-native/textAnalyticsOperationOptions.d.ts +1 -1
  29. package/dist/react-native/textAnalyticsOperationOptions.js.map +1 -1
  30. package/package.json +2 -2
package/README.md CHANGED
@@ -25,8 +25,8 @@ Key links:
25
25
 
26
26
  - [Source code](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/textanalytics/ai-text-analytics/)
27
27
  - [Package (NPM)](https://www.npmjs.com/package/@azure/ai-text-analytics)
28
- - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/ai-text-analytics)
29
- - [Product documentation](https://docs.microsoft.com/azure/cognitive-services/text-analytics/)
28
+ - [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/ai-text-analytics)
29
+ - [Product documentation](https://learn.microsoft.com/azure/cognitive-services/text-analytics/)
30
30
  - [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/textanalytics/ai-text-analytics/samples)
31
31
 
32
32
  ## Getting started
@@ -306,7 +306,7 @@ async function main() {
306
306
  '"' + match.text + '"',
307
307
  "(Score:",
308
308
  match.confidenceScore,
309
- ")"
309
+ ")",
310
310
  );
311
311
  }
312
312
  }
@@ -382,7 +382,7 @@ async function main() {
382
382
  primaryLanguage.iso6391Name,
383
383
  ", Score:",
384
384
  primaryLanguage.confidenceScore,
385
- ")"
385
+ ")",
386
386
  );
387
387
  } else {
388
388
  console.error("Encountered an error:", result.error);
@@ -528,13 +528,13 @@ If you'd like to contribute to this library, please read the [contributing guide
528
528
 
529
529
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Ftextanalytics%2Fai-text-analytics%2FREADME.png)
530
530
 
531
- [azure_cli]: https://docs.microsoft.com/cli/azure
531
+ [azure_cli]: https://learn.microsoft.com/cli/azure
532
532
  [azure_sub]: https://azure.microsoft.com/free/
533
- [cognitive_resource]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account
533
+ [cognitive_resource]: https://learn.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account
534
534
  [azure_portal]: https://portal.azure.com
535
535
  [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
536
- [cognitive_auth]: https://docs.microsoft.com/azure/cognitive-services/authentication
537
- [register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
536
+ [cognitive_auth]: https://learn.microsoft.com/azure/cognitive-services/authentication
537
+ [register_aad_app]: https://learn.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
538
538
  [defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
539
- [data_limits]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits
539
+ [data_limits]: https://learn.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits
540
540
  [analyze_sentiment_opinion_mining_sample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/textanalytics/ai-text-analytics/samples/v5/typescript/src/analyzeSentimentWithOpinionMining.ts
@@ -24,7 +24,7 @@ export interface AnalyzeSentimentSuccessResult extends TextAnalyticsSuccessResul
24
24
  sentences: SentenceSentiment[];
25
25
  }
26
26
  /**
27
- * The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis.
27
+ * The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis.
28
28
  */
29
29
  export interface SentenceSentiment {
30
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"analyzeSentimentResult.js","sourceRoot":"","sources":["../../src/analyzeSentimentResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAelC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAuHjD;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAyB;IAEzB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AAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,0CAA0C,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;aACnF,CAAC,CACH;YACH,CAAC,CAAC,EAAE;KACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,0CAA0C,CACjD,cAA8B,EAC9B,MAAyB;;IAEzB,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC;IACzC,MAAM,eAAe,GAAoB,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC7E,MAAM,UAAU,GACd,MAAA,MAAA,MAAM,CAAC,kBAAkB,0CAAG,eAAe,CAAC,QAAQ,EAAE,WAAW,0CAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAClG,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,YAAY,aAAa,qCAAqC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DocumentSentiment,\n DocumentSentimentLabel,\n SentenceSentiment as GeneratedSentenceSentiment,\n SentenceAssessment,\n SentenceSentimentLabel,\n SentenceTarget,\n TokenSentimentValue as SentenceTargetSentiment,\n SentimentConfidenceScores,\n TargetConfidenceScoreLabel,\n TargetRelation,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\nimport type { AssessmentIndex } from \"./util.js\";\nimport { parseAssessmentIndex } from \"./util.js\";\n\n/**\n * The result of the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentResult = AnalyzeSentimentSuccessResult | AnalyzeSentimentErrorResult;\n\n/**\n * The result of the analyze sentiment operation on a single document,\n * containing the predicted sentiment for each sentence as well as for the full document.\n */\nexport interface AnalyzeSentimentSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * Predicted sentiment for document. Possible values\n * include: 'positive', 'neutral', 'negative', 'mixed'\n */\n sentiment: DocumentSentimentLabel;\n /**\n * Document level sentiment confidence scores between 0 and 1 for each sentiment class.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The predicted sentiment for each sentence in the corresponding document.\n */\n sentences: SentenceSentiment[];\n}\n\n/**\n * The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis.\n */\nexport interface SentenceSentiment {\n /**\n * The sentence text.\n */\n text: string;\n /**\n * The predicted Sentiment for the sentence.\n */\n sentiment: SentenceSentimentLabel;\n /**\n * The sentiment confidence score between 0 and 1 for the sentence for all classes.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The sentence text offset from the start of the document.\n */\n offset: number;\n /**\n * The length of the sentence text.\n */\n length: number;\n /**\n * The list of opinions mined from this sentence. For example in \"The food is\n * good, but the service is bad\", we would mine these two opinions \"food is\n * good\", \"service is bad\". Only returned if `includeOpinionMining` is set to\n * True in the call to `analyzeSentiment`.\n */\n opinions: Opinion[];\n}\n\n/**\n * TargetSentiment contains the predicted sentiment, confidence scores and other\n * information about an target of a product. A target of a product/service is a\n * key component of that product/service. For example in \"The food at Hotel Foo\n * is good\", \"food\" is a target of \"Hotel Foo\".\n */\nexport interface TargetSentiment {\n /**\n * The sentiment confidence score between 0 and 1 for the target for\n * 'positive' and 'negative' labels.\n */\n confidenceScores: TargetConfidenceScoreLabel;\n /**\n * The predicted Sentiment for the Target. Possible values include 'positive',\n * 'mixed', and 'negative'.\n */\n sentiment: SentenceTargetSentiment;\n /**\n * The target text.\n */\n text: string;\n /**\n * The Target text offset from the start of the sentence.\n */\n offset: number;\n /**\n * The length of the Target text.\n */\n length: number;\n}\n\n/**\n * AssessmentSentiment contains the predicted sentiment, confidence scores and\n * other information about an assessment of a target. For example, in the sentence\n * \"The food is good\", the assessment of the target 'food' is 'good'.\n */\nexport interface AssessmentSentiment extends SentenceAssessment {}\n\n/**\n * A mined opinion object represents an opinion we've extracted from a sentence.\n * It consists of both a target that these assessments are about, and the actual\n * assessments themselves.\n */\nexport interface Opinion {\n /**\n * The target of a product/service that this assessment is about.\n */\n target: TargetSentiment;\n /**\n * The actual assessments of the target.\n */\n assessments: AssessmentSentiment[];\n}\n\n/**\n * An error result from the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @param document - A document result coming from the service.\n * @internal\n */\nexport function makeAnalyzeSentimentResult(\n result: DocumentSentiment,\n): AnalyzeSentimentSuccessResult {\n const {\n id,\n sentiment,\n confidenceScores,\n sentenceSentiments: sentences,\n warnings,\n statistics,\n } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n sentiment,\n confidenceScores,\n sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)),\n };\n}\n\n/**\n * @internal\n */\nexport function makeAnalyzeSentimentErrorResult(\n id: string,\n error: TextAnalyticsError,\n): AnalyzeSentimentErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n\n/**\n * Converts a sentence sentiment object returned by the service to another that\n * is user-friendly.\n *\n * @param sentence - The sentence sentiment object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly sentence sentiment object.\n * @internal\n */\nfunction convertGeneratedSentenceSentiment(\n sentence: GeneratedSentenceSentiment,\n result: DocumentSentiment,\n): SentenceSentiment {\n return {\n confidenceScores: sentence.confidenceScores,\n sentiment: sentence.sentiment,\n text: sentence.text,\n offset: sentence.offset,\n length: sentence.length,\n opinions: sentence.targets\n ? sentence.targets.map(\n (target: SentenceTarget): Opinion => ({\n target: {\n confidenceScores: target.confidenceScores,\n sentiment: target.sentiment,\n text: target.text,\n offset: target.offset,\n length: target.length,\n },\n assessments: target.relations\n .filter((relation) => relation.relationType === \"assessment\")\n .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result)),\n }),\n )\n : [],\n };\n}\n\n/**\n * Converts a target relation object returned by the service to an assessment\n * sentiment object where JSON pointers in the former are realized in the\n * latter.\n *\n * @param targetRelation - The target relation object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly assessment sentiment object.\n * @internal\n */\nfunction convertTargetRelationToAssessmentSentiment(\n targetRelation: TargetRelation,\n result: DocumentSentiment,\n): AssessmentSentiment {\n const assessmentPtr = targetRelation.ref;\n const assessmentIndex: AssessmentIndex = parseAssessmentIndex(assessmentPtr);\n const assessment: SentenceAssessment | undefined =\n result.sentenceSentiments?.[assessmentIndex.sentence].assessments?.[assessmentIndex.assessment];\n if (assessment !== undefined) {\n return assessment;\n } else {\n throw new Error(`Pointer \"${assessmentPtr}\" is not a valid Assessment pointer`);\n }\n}\n"]}
1
+ {"version":3,"file":"analyzeSentimentResult.js","sourceRoot":"","sources":["../../src/analyzeSentimentResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAelC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAuHjD;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAyB;IAEzB,MAAM,EACJ,EAAE,EACF,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAAE,SAAS,EAC7B,QAAQ,EACR,UAAU,GACX,GAAG,MAAM,CAAC;IACX,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,SAAS;QACT,gBAAgB,EAChB,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iCAAiC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAC3F;AACJ,CAAC;AAED;;GAEG;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AA,MAAM,CAAC,kBAAkB,0CAAG,eAAe,CAAC,QAAQ,EAAE,WAAW,0CAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAClG,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,YAAY,aAAa,qCAAqC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DocumentSentiment,\n DocumentSentimentLabel,\n SentenceSentiment as GeneratedSentenceSentiment,\n SentenceAssessment,\n SentenceSentimentLabel,\n SentenceTarget,\n TokenSentimentValue as SentenceTargetSentiment,\n SentimentConfidenceScores,\n TargetConfidenceScoreLabel,\n TargetRelation,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\nimport type { AssessmentIndex } from \"./util.js\";\nimport { parseAssessmentIndex } from \"./util.js\";\n\n/**\n * The result of the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentResult = AnalyzeSentimentSuccessResult | AnalyzeSentimentErrorResult;\n\n/**\n * The result of the analyze sentiment operation on a single document,\n * containing the predicted sentiment for each sentence as well as for the full document.\n */\nexport interface AnalyzeSentimentSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * Predicted sentiment for document. Possible values\n * include: 'positive', 'neutral', 'negative', 'mixed'\n */\n sentiment: DocumentSentimentLabel;\n /**\n * Document level sentiment confidence scores between 0 and 1 for each sentiment class.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The predicted sentiment for each sentence in the corresponding document.\n */\n sentences: SentenceSentiment[];\n}\n\n/**\n * The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis.\n */\nexport interface SentenceSentiment {\n /**\n * The sentence text.\n */\n text: string;\n /**\n * The predicted Sentiment for the sentence.\n */\n sentiment: SentenceSentimentLabel;\n /**\n * The sentiment confidence score between 0 and 1 for the sentence for all classes.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The sentence text offset from the start of the document.\n */\n offset: number;\n /**\n * The length of the sentence text.\n */\n length: number;\n /**\n * The list of opinions mined from this sentence. For example in \"The food is\n * good, but the service is bad\", we would mine these two opinions \"food is\n * good\", \"service is bad\". Only returned if `includeOpinionMining` is set to\n * True in the call to `analyzeSentiment`.\n */\n opinions: Opinion[];\n}\n\n/**\n * TargetSentiment contains the predicted sentiment, confidence scores and other\n * information about an target of a product. A target of a product/service is a\n * key component of that product/service. For example in \"The food at Hotel Foo\n * is good\", \"food\" is a target of \"Hotel Foo\".\n */\nexport interface TargetSentiment {\n /**\n * The sentiment confidence score between 0 and 1 for the target for\n * 'positive' and 'negative' labels.\n */\n confidenceScores: TargetConfidenceScoreLabel;\n /**\n * The predicted Sentiment for the Target. Possible values include 'positive',\n * 'mixed', and 'negative'.\n */\n sentiment: SentenceTargetSentiment;\n /**\n * The target text.\n */\n text: string;\n /**\n * The Target text offset from the start of the sentence.\n */\n offset: number;\n /**\n * The length of the Target text.\n */\n length: number;\n}\n\n/**\n * AssessmentSentiment contains the predicted sentiment, confidence scores and\n * other information about an assessment of a target. For example, in the sentence\n * \"The food is good\", the assessment of the target 'food' is 'good'.\n */\nexport interface AssessmentSentiment extends SentenceAssessment {}\n\n/**\n * A mined opinion object represents an opinion we've extracted from a sentence.\n * It consists of both a target that these assessments are about, and the actual\n * assessments themselves.\n */\nexport interface Opinion {\n /**\n * The target of a product/service that this assessment is about.\n */\n target: TargetSentiment;\n /**\n * The actual assessments of the target.\n */\n assessments: AssessmentSentiment[];\n}\n\n/**\n * An error result from the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @param document - A document result coming from the service.\n * @internal\n */\nexport function makeAnalyzeSentimentResult(\n result: DocumentSentiment,\n): AnalyzeSentimentSuccessResult {\n const {\n id,\n sentiment,\n confidenceScores,\n sentenceSentiments: sentences,\n warnings,\n statistics,\n } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n sentiment,\n confidenceScores,\n sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)),\n };\n}\n\n/**\n * @internal\n */\nexport function makeAnalyzeSentimentErrorResult(\n id: string,\n error: TextAnalyticsError,\n): AnalyzeSentimentErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n\n/**\n * Converts a sentence sentiment object returned by the service to another that\n * is user-friendly.\n *\n * @param sentence - The sentence sentiment object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly sentence sentiment object.\n * @internal\n */\nfunction convertGeneratedSentenceSentiment(\n sentence: GeneratedSentenceSentiment,\n result: DocumentSentiment,\n): SentenceSentiment {\n return {\n confidenceScores: sentence.confidenceScores,\n sentiment: sentence.sentiment,\n text: sentence.text,\n offset: sentence.offset,\n length: sentence.length,\n opinions: sentence.targets\n ? sentence.targets.map(\n (target: SentenceTarget): Opinion => ({\n target: {\n confidenceScores: target.confidenceScores,\n sentiment: target.sentiment,\n text: target.text,\n offset: target.offset,\n length: target.length,\n },\n assessments: target.relations\n .filter((relation) => relation.relationType === \"assessment\")\n .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result)),\n }),\n )\n : [],\n };\n}\n\n/**\n * Converts a target relation object returned by the service to an assessment\n * sentiment object where JSON pointers in the former are realized in the\n * latter.\n *\n * @param targetRelation - The target relation object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly assessment sentiment object.\n * @internal\n */\nfunction convertTargetRelationToAssessmentSentiment(\n targetRelation: TargetRelation,\n result: DocumentSentiment,\n): AssessmentSentiment {\n const assessmentPtr = targetRelation.ref;\n const assessmentIndex: AssessmentIndex = parseAssessmentIndex(assessmentPtr);\n const assessment: SentenceAssessment | undefined =\n result.sentenceSentiments?.[assessmentIndex.sentence].assessments?.[assessmentIndex.assessment];\n if (assessment !== undefined) {\n return assessment;\n } else {\n throw new Error(`Pointer \"${assessmentPtr}\" is not a valid Assessment pointer`);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/health/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAkBlC,OAAO,EACL,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,UAAU,GACX,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,gDAAgD,EAAE,MAAM,8BAA8B,CAAC;AAiFhG;;GAEG;AACH,SAAS,uBAAuB,CAC9B,QAA4B;IAE5B,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,eAAe;QACnC,cAAc,EAAE,QAAQ,CAAC,kBAAkB;QAC3C,SAAS,EAAE,QAAQ,CAAC,kBAAkB;QACtC,MAAM,EAAE,QAAQ,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,qCAAsC,SAAQ,qBAG1D;IACC,YACS,KAAsC;IAC7C,wEAAwE;IAChE,MAAc,EACd,OAAsB,EACtB,SAA8B,EAC9B,UAAiD,EAAE;QAE3D,KAAK,CAAC,KAAK,CAAC,CAAC;QAPN,UAAK,GAAL,KAAK,CAAiC;QAErC,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAe;QACtB,cAAS,GAAT,SAAS,CAAqB;QAC9B,YAAO,GAAP,OAAO,CAA4C;IAG7D,CAAC;IAED;;;;OAIG;IACK,4BAA4B,CAClC,WAAmB,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;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure/core-client\";\n\nimport type {\n HealthResponse as BeginAnalyzeHealthcareResponse,\n HealthcareJobState,\n HealthStatusOptionalParams as HealthcareJobStatusOptions,\n TextDocumentBatchStatistics,\n TextDocumentInput,\n} from \"../../generated/models/index.js\";\nimport type {\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray,\n PagedAnalyzeHealthcareEntitiesResult,\n PagedAsyncIterableAnalyzeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport {\n makeHealthcareEntitiesErrorResult,\n makeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport type { PageSettings } from \"@azure/core-paging\";\nimport type { StringIndexType } from \"../../util.js\";\nimport {\n addStrEncodingParam,\n getOperationId,\n nextLinkToTopAndSkip,\n throwError,\n} from \"../../util.js\";\nimport type {\n AnalysisPollOperationState,\n OperationMetadata as AnalyzeHealthcareEntitiesOperationMetadata,\n} from \"../poller.js\";\nimport { AnalysisPollOperation } from \"../poller.js\";\nimport type { GeneratedClient as Client } from \"../../generated/index.js\";\nimport { processAndCombineSuccessfulAndErroneousDocuments } from \"../../textAnalyticsResult.js\";\nimport type { TextAnalyticsOperationOptions } from \"../../textAnalyticsOperationOptions.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\n\n/**\n * @internal\n */\ninterface AnalyzeHealthcareEntitiesResultWithPagination {\n result: AnalyzeHealthcareEntitiesResultArray;\n top?: number;\n skip?: number;\n}\n\n/**\n * @internal\n */\ninterface HealthcareJobStatus {\n done: boolean;\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 operationMetdata: Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\">;\n}\n\n/**\n * @internal\n */\ninterface BeginAnalyzeHealthcareInternalOptions extends OperationOptions {\n /**\n * This value indicates which model will be used for scoring. If a model-version is\n * not specified, the API should default to the latest, non-preview version.\n * For supported model versions, see operation-specific documentation, for example:\n * https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis#model-versioning\n */\n modelVersion?: string;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for healthcare entities analysis. Setting this parameter to false,\n * enables input logging.\n */\n loggingOptOut?: boolean;\n}\n\n/**\n * Options for the begin analyze healthcare entities operation.\n */\nexport interface BeginAnalyzeHealthcareEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n stringIndexType?: StringIndexType;\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n resumeFrom?: string;\n}\n\n/**\n * The state of the begin analyze healthcare polling operation.\n */\nexport interface AnalyzeHealthcareOperationState\n extends AnalysisPollOperationState<PagedAnalyzeHealthcareEntitiesResult> {}\n\n/**\n * @internal\n */\nfunction getMetaInfoFromResponse(\n response: HealthcareJobState,\n): Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\"> {\n return {\n createdOn: response.createdDateTime,\n lastModifiedOn: response.lastUpdateDateTime,\n expiresOn: response.expirationDateTime,\n status: response.status,\n };\n}\n\n/**\n * Class that represents a poller that waits for the healthcare results.\n * @internal\n */\nexport class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n> {\n constructor(\n public state: AnalyzeHealthcareOperationState,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: Client,\n private tracing: TracingClient,\n private documents: TextDocumentInput[],\n private options: BeginAnalyzeHealthcareEntitiesOptions = {},\n ) {\n super(state);\n }\n\n /**\n * should be called only after all the status of the healthcare operations became\n * \"succeeded\" and it returns an iterator for the results and provides a\n * byPage method to return the results paged.\n */\n private listHealthcareEntitiesByPage(\n operationId: string,\n options: HealthcareJobStatusOptions = {},\n ): PagedAsyncIterableAnalyzeHealthcareEntitiesResult {\n const iter = this._listHealthcareEntities(operationId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n const pageOptions = { ...options, top: settings?.maxPageSize };\n return this._listHealthcareEntitiesPaged(operationId, pageOptions);\n },\n };\n }\n\n /**\n * returns an iterator to the results of a healthcare operation.\n */\n private async *_listHealthcareEntities(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResult> {\n for await (const page of this._listHealthcareEntitiesPaged(operationId, options)) {\n yield* page;\n }\n }\n\n /**\n * returns an iterator to arrays of the results of a healthcare operation.\n */\n private async *_listHealthcareEntitiesPaged(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResultArray> {\n let response = await this._listHealthcareEntitiesSinglePage(operationId, options);\n yield response.result;\n while (response.skip) {\n const optionsWithContinuation: HealthcareJobStatusOptions = {\n ...options,\n top: response.top,\n skip: response.skip,\n };\n response = await this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation);\n yield response.result;\n }\n }\n\n /**\n * returns an iterator to arrays of the sorted results of a healthcare operation.\n */\n private async _listHealthcareEntitiesSinglePage(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<AnalyzeHealthcareEntitiesResultWithPagination> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-_listHealthcareEntitiesSinglePage\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n if (response.results) {\n const result = processAndCombineSuccessfulAndErroneousDocuments(\n this.documents,\n response.results,\n makeHealthcareEntitiesResult,\n makeHealthcareEntitiesErrorResult,\n );\n return response.nextLink\n ? { result, ...nextLinkToTopAndSkip(response.nextLink) }\n : { result };\n } else {\n throw new Error(\"Healthcare action has succeeded but the there are no results!\");\n }\n }\n\n /**\n * returns whether the healthcare operation is done and if so returns also\n * statistics and the model version used.\n */\n private async getHealthStatus(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<HealthcareJobStatus> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-getHealthStatus\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n switch (response.status) {\n case \"notStarted\":\n case \"running\":\n break;\n case \"failed\": {\n const errors = response.errors\n ?.map((e) => ` code ${e.code}, message: '${e.message}'`)\n .join(\"\\n\");\n const message = `Healthcare analysis failed. Error(s): ${errors || \"\"}`;\n throw new Error(message);\n }\n default: {\n if (response.results) {\n return {\n done: true,\n statistics: response.results.statistics,\n modelVersion: response.results.modelVersion,\n operationMetdata: getMetaInfoFromResponse(response),\n };\n } else {\n throw new Error(\"Healthcare action has finished but the there are no results!\");\n }\n }\n }\n return { done: false, operationMetdata: getMetaInfoFromResponse(response) };\n }\n\n private async beginAnalyzeHealthcare(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareInternalOptions,\n ): Promise<BeginAnalyzeHealthcareResponse> {\n return this.tracing.withSpan(\n \"TextAnalyticsClient-beginAnalyzeHealthcare\",\n addStrEncodingParam(options || {}),\n (finalOptions) => throwError(this.client.health({ documents: documents }, finalOptions)),\n );\n }\n\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: AnalyzeHealthcareOperationState) => void;\n } = {},\n ): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n const updatedAbortSignal = options.abortSignal;\n if (!state.isStarted) {\n state.isStarted = true;\n const response = await this.beginAnalyzeHealthcare(this.documents, {\n requestOptions: this.options.requestOptions,\n tracingOptions: this.options.tracingOptions,\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n modelVersion: this.options.modelVersion,\n stringIndexType: this.options.stringIndexType,\n loggingOptOut: this.options.disableServiceLogs,\n });\n if (!response.operationLocation) {\n throw new Error(\n \"Expects a valid 'operationLocation' to retrieve health results but did not find any\",\n );\n }\n state.operationId = getOperationId(response.operationLocation);\n }\n const operationStatus = await this.getHealthStatus(state.operationId!, {\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n includeStatistics: this.options.includeStatistics,\n tracingOptions: this.options.tracingOptions,\n onResponse: this.options.onResponse,\n serializerOptions: this.options.serializerOptions,\n });\n\n state.createdOn = operationStatus.operationMetdata.createdOn;\n state.expiresOn = operationStatus.operationMetdata.expiresOn;\n state.lastModifiedOn = operationStatus.operationMetdata.lastModifiedOn;\n state.status = operationStatus.operationMetdata.status;\n\n if (!state.isCompleted && operationStatus.done) {\n const pagedIterator = this.listHealthcareEntitiesByPage(state.operationId!, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n state.result = Object.assign(pagedIterator, {\n statistics: operationStatus.statistics,\n modelVersion: operationStatus.modelVersion!,\n });\n state.isCompleted = true;\n }\n if (typeof options.fireProgress === \"function\") {\n options.fireProgress(state);\n }\n return this;\n }\n\n async cancel(): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n if (state.operationId) {\n await this.client.cancelHealthJob(state.operationId, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n }\n state.isCancelled = true;\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/health/operation.ts"],"names":[],"mappings":"AAAA,uCAA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AA4B,CAAC,KAAK,CAAC,WAAY,EAAE;gBAC1E,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;gBACrC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;aAC5C,CAAC,CAAC;YACH,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE;gBAC1C,UAAU,EAAE,eAAe,CAAC,UAAU;gBACtC,YAAY,EAAE,eAAe,CAAC,YAAa;aAC5C,CAAC,CAAC;YACH,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,CAAC;QACD,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YAC/C,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,EAAE;gBACnD,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;gBACrC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;aAC5C,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure/core-client\";\n\nimport type {\n HealthResponse as BeginAnalyzeHealthcareResponse,\n HealthcareJobState,\n HealthStatusOptionalParams as HealthcareJobStatusOptions,\n TextDocumentBatchStatistics,\n TextDocumentInput,\n} from \"../../generated/models/index.js\";\nimport type {\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray,\n PagedAnalyzeHealthcareEntitiesResult,\n PagedAsyncIterableAnalyzeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport {\n makeHealthcareEntitiesErrorResult,\n makeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport type { PageSettings } from \"@azure/core-paging\";\nimport type { StringIndexType } from \"../../util.js\";\nimport {\n addStrEncodingParam,\n getOperationId,\n nextLinkToTopAndSkip,\n throwError,\n} from \"../../util.js\";\nimport type {\n AnalysisPollOperationState,\n OperationMetadata as AnalyzeHealthcareEntitiesOperationMetadata,\n} from \"../poller.js\";\nimport { AnalysisPollOperation } from \"../poller.js\";\nimport type { GeneratedClient as Client } from \"../../generated/index.js\";\nimport { processAndCombineSuccessfulAndErroneousDocuments } from \"../../textAnalyticsResult.js\";\nimport type { TextAnalyticsOperationOptions } from \"../../textAnalyticsOperationOptions.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\n\n/**\n * @internal\n */\ninterface AnalyzeHealthcareEntitiesResultWithPagination {\n result: AnalyzeHealthcareEntitiesResultArray;\n top?: number;\n skip?: number;\n}\n\n/**\n * @internal\n */\ninterface HealthcareJobStatus {\n done: boolean;\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 operationMetdata: Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\">;\n}\n\n/**\n * @internal\n */\ninterface BeginAnalyzeHealthcareInternalOptions extends OperationOptions {\n /**\n * This value indicates which model will be used for scoring. If a model-version is\n * not specified, the API should default to the latest, non-preview version.\n * For supported model versions, see operation-specific documentation, for example:\n * https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis#model-versioning\n */\n modelVersion?: string;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for healthcare entities analysis. Setting this parameter to false,\n * enables input logging.\n */\n loggingOptOut?: boolean;\n}\n\n/**\n * Options for the begin analyze healthcare entities operation.\n */\nexport interface BeginAnalyzeHealthcareEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n stringIndexType?: StringIndexType;\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n resumeFrom?: string;\n}\n\n/**\n * The state of the begin analyze healthcare polling operation.\n */\nexport interface AnalyzeHealthcareOperationState\n extends AnalysisPollOperationState<PagedAnalyzeHealthcareEntitiesResult> {}\n\n/**\n * @internal\n */\nfunction getMetaInfoFromResponse(\n response: HealthcareJobState,\n): Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\"> {\n return {\n createdOn: response.createdDateTime,\n lastModifiedOn: response.lastUpdateDateTime,\n expiresOn: response.expirationDateTime,\n status: response.status,\n };\n}\n\n/**\n * Class that represents a poller that waits for the healthcare results.\n * @internal\n */\nexport class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n> {\n constructor(\n public state: AnalyzeHealthcareOperationState,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: Client,\n private tracing: TracingClient,\n private documents: TextDocumentInput[],\n private options: BeginAnalyzeHealthcareEntitiesOptions = {},\n ) {\n super(state);\n }\n\n /**\n * should be called only after all the status of the healthcare operations became\n * \"succeeded\" and it returns an iterator for the results and provides a\n * byPage method to return the results paged.\n */\n private listHealthcareEntitiesByPage(\n operationId: string,\n options: HealthcareJobStatusOptions = {},\n ): PagedAsyncIterableAnalyzeHealthcareEntitiesResult {\n const iter = this._listHealthcareEntities(operationId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n const pageOptions = { ...options, top: settings?.maxPageSize };\n return this._listHealthcareEntitiesPaged(operationId, pageOptions);\n },\n };\n }\n\n /**\n * returns an iterator to the results of a healthcare operation.\n */\n private async *_listHealthcareEntities(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResult> {\n for await (const page of this._listHealthcareEntitiesPaged(operationId, options)) {\n yield* page;\n }\n }\n\n /**\n * returns an iterator to arrays of the results of a healthcare operation.\n */\n private async *_listHealthcareEntitiesPaged(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResultArray> {\n let response = await this._listHealthcareEntitiesSinglePage(operationId, options);\n yield response.result;\n while (response.skip) {\n const optionsWithContinuation: HealthcareJobStatusOptions = {\n ...options,\n top: response.top,\n skip: response.skip,\n };\n response = await this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation);\n yield response.result;\n }\n }\n\n /**\n * returns an iterator to arrays of the sorted results of a healthcare operation.\n */\n private async _listHealthcareEntitiesSinglePage(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<AnalyzeHealthcareEntitiesResultWithPagination> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-_listHealthcareEntitiesSinglePage\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n if (response.results) {\n const result = processAndCombineSuccessfulAndErroneousDocuments(\n this.documents,\n response.results,\n makeHealthcareEntitiesResult,\n makeHealthcareEntitiesErrorResult,\n );\n return response.nextLink\n ? { result, ...nextLinkToTopAndSkip(response.nextLink) }\n : { result };\n } else {\n throw new Error(\"Healthcare action has succeeded but the there are no results!\");\n }\n }\n\n /**\n * returns whether the healthcare operation is done and if so returns also\n * statistics and the model version used.\n */\n private async getHealthStatus(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<HealthcareJobStatus> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-getHealthStatus\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n switch (response.status) {\n case \"notStarted\":\n case \"running\":\n break;\n case \"failed\": {\n const errors = response.errors\n ?.map((e) => ` code ${e.code}, message: '${e.message}'`)\n .join(\"\\n\");\n const message = `Healthcare analysis failed. Error(s): ${errors || \"\"}`;\n throw new Error(message);\n }\n default: {\n if (response.results) {\n return {\n done: true,\n statistics: response.results.statistics,\n modelVersion: response.results.modelVersion,\n operationMetdata: getMetaInfoFromResponse(response),\n };\n } else {\n throw new Error(\"Healthcare action has finished but the there are no results!\");\n }\n }\n }\n return { done: false, operationMetdata: getMetaInfoFromResponse(response) };\n }\n\n private async beginAnalyzeHealthcare(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareInternalOptions,\n ): Promise<BeginAnalyzeHealthcareResponse> {\n return this.tracing.withSpan(\n \"TextAnalyticsClient-beginAnalyzeHealthcare\",\n addStrEncodingParam(options || {}),\n (finalOptions) => throwError(this.client.health({ documents: documents }, finalOptions)),\n );\n }\n\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: AnalyzeHealthcareOperationState) => void;\n } = {},\n ): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n const updatedAbortSignal = options.abortSignal;\n if (!state.isStarted) {\n state.isStarted = true;\n const response = await this.beginAnalyzeHealthcare(this.documents, {\n requestOptions: this.options.requestOptions,\n tracingOptions: this.options.tracingOptions,\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n modelVersion: this.options.modelVersion,\n stringIndexType: this.options.stringIndexType,\n loggingOptOut: this.options.disableServiceLogs,\n });\n if (!response.operationLocation) {\n throw new Error(\n \"Expects a valid 'operationLocation' to retrieve health results but did not find any\",\n );\n }\n state.operationId = getOperationId(response.operationLocation);\n }\n const operationStatus = await this.getHealthStatus(state.operationId!, {\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n includeStatistics: this.options.includeStatistics,\n tracingOptions: this.options.tracingOptions,\n onResponse: this.options.onResponse,\n serializerOptions: this.options.serializerOptions,\n });\n\n state.createdOn = operationStatus.operationMetdata.createdOn;\n state.expiresOn = operationStatus.operationMetdata.expiresOn;\n state.lastModifiedOn = operationStatus.operationMetdata.lastModifiedOn;\n state.status = operationStatus.operationMetdata.status;\n\n if (!state.isCompleted && operationStatus.done) {\n const pagedIterator = this.listHealthcareEntitiesByPage(state.operationId!, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n state.result = Object.assign(pagedIterator, {\n statistics: operationStatus.statistics,\n modelVersion: operationStatus.modelVersion!,\n });\n state.isCompleted = true;\n }\n if (typeof options.fireProgress === \"function\") {\n options.fireProgress(state);\n }\n return this;\n }\n\n async cancel(): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n if (state.operationId) {\n await this.client.cancelHealthJob(state.operationId, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n }\n state.isCancelled = true;\n return this;\n }\n}\n"]}
@@ -55,7 +55,7 @@ export interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {
55
55
  * aspect-based sentiment analysis). If set to true, the returned
56
56
  * `SentenceSentiment` objects will have property `opinions` containing
57
57
  * the result of this analysis.
58
- * More information about the feature can be found here: {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}
58
+ * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}
59
59
  */
60
60
  includeOpinionMining?: boolean;
61
61
  /**
@@ -205,7 +205,7 @@ export interface AnalyzeSentimentAction extends TextAnalyticsAction {
205
205
  * aspect-based sentiment analysis). If set to true, the returned
206
206
  * `SentenceSentiment` objects will have property `opinions` containing
207
207
  * the result of this analysis.
208
- * More information about the feature can be found here: {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}
208
+ * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}
209
209
  */
210
210
  includeOpinionMining?: boolean;
211
211
  }
@@ -305,9 +305,9 @@ export declare class TextAnalyticsClient {
305
305
  * in the passed-in input strings, and categorize those entities into types
306
306
  * such as person, location, or organization. For more information on
307
307
  * available categories, @see
308
- * {@link https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.
308
+ * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.
309
309
  * For a list of languages supported by this operation, @see
310
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
310
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
311
311
  * @param documents - The input strings to analyze.
312
312
  * @param language - The language that all the input strings are
313
313
  written in. If unspecified, this value will be set to the default
@@ -322,9 +322,9 @@ export declare class TextAnalyticsClient {
322
322
  * in the passed-in input documents, and categorize those entities into types
323
323
  * such as person, location, or organization. For more information on
324
324
  * available categories, @see
325
- * {@link https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.
325
+ * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.
326
326
  * For a list of languages supported by this operation, @see
327
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
327
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
328
328
  * @param documents - The input documents to analyze.
329
329
  * @param options - Optional parameters for the operation.
330
330
  */
@@ -335,7 +335,7 @@ export declare class TextAnalyticsClient {
335
335
  * the model's confidence in each of the predicted sentiments. Optionally it
336
336
  * can also identify targets in the text and assessments about it through
337
337
  * opinion mining. For a list of languages supported by this operation, @see
338
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
338
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
339
339
  * @param documents - The input strings to analyze.
340
340
  * @param language - The language that all the input strings are
341
341
  written in. If unspecified, this value will be set to the default
@@ -351,7 +351,7 @@ export declare class TextAnalyticsClient {
351
351
  * the model's confidence in each of the predicted sentiments.Optionally it
352
352
  * can also identify targets in the text and assessments about it through
353
353
  * opinion mining. For a list of languages supported by this operation, @see
354
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
354
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
355
355
  * @param documents - The input documents to analyze.
356
356
  * @param options - Optional parameters that includes enabling opinion mining.
357
357
  */
@@ -360,7 +360,7 @@ export declare class TextAnalyticsClient {
360
360
  * Runs a model to identify a collection of significant phrases
361
361
  * found in the passed-in input strings.
362
362
  * For a list of languages supported by this operation, @see
363
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
363
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
364
364
  * @param documents - The input strings to analyze.
365
365
  * @param language - The language that all the input strings are
366
366
  written in. If unspecified, this value will be set to the default
@@ -374,7 +374,7 @@ export declare class TextAnalyticsClient {
374
374
  * Runs a model to identify a collection of significant phrases
375
375
  * found in the passed-in input documents.
376
376
  * For a list of languages supported by this operation, @see
377
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
377
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
378
378
  * @param documents - The input documents to analyze.
379
379
  * @param options - Options for the operation.
380
380
  */
@@ -385,7 +385,7 @@ export declare class TextAnalyticsClient {
385
385
  * and categorize those entities into types such as US social security
386
386
  * number, drivers license number, or credit card number.
387
387
  * For a list of languages supported by this operation, @see
388
- * {@link https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.
388
+ * {@link https://learn.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.
389
389
  * @param inputs - The input strings to analyze.
390
390
  * @param language - The language that all the input strings are
391
391
  written in. If unspecified, this value will be set to the default
@@ -401,7 +401,7 @@ export declare class TextAnalyticsClient {
401
401
  * and categorize those entities into types such as US social security
402
402
  * number, drivers license number, or credit card number.
403
403
  * For a list of languages supported by this operation, @see
404
- * {@link https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.
404
+ * {@link https://learn.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.
405
405
  * @param inputs - The input documents to analyze.
406
406
  * @param options - Optional parameters for the operation.
407
407
  */
@@ -411,7 +411,7 @@ export declare class TextAnalyticsClient {
411
411
  * found in the passed-in input strings, and include information linking the
412
412
  * entities to their corresponding entries in a well-known knowledge base.
413
413
  * For a list of languages supported by this operation, @see
414
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
414
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
415
415
  * @param documents - The input strings to analyze.
416
416
  * @param language - The language that all the input strings are
417
417
  written in. If unspecified, this value will be set to the default
@@ -426,7 +426,7 @@ export declare class TextAnalyticsClient {
426
426
  * found in the passed-in input documents, and include information linking the
427
427
  * entities to their corresponding entries in a well-known knowledge base.
428
428
  * For a list of languages supported by this operation, @see
429
- * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
429
+ * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.
430
430
  * @param documents - The input documents to analyze.
431
431
  * @param options - Options for the operation.
432
432
  */
@@ -1 +1 @@
1
- {"version":3,"file":"textAnalyticsClient.js","sourceRoot":"","sources":["../../src/textAnalyticsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AAC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AqC,CAC5C,MAAgC;IAEhC,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,aAAa,EAAE,MAAM,CAAC,kBAAkB;KACzC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,4CAA4C,CACnD,MAAsC;IAEtC,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,aAAa,EAAE,MAAM,CAAC,kBAAkB;QACxC,eAAe,EAAE,wBAAwB,CAAC,MAAM,CAAC,eAAe,CAAC;KAClE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\nimport type {\n DetectLanguageInput,\n JobManifestTasks as GeneratedActions,\n SentimentOptionalParams as GeneratedAnalyzeSentimentOptions,\n LanguagesOptionalParams as GeneratedDetectLanguageOptions,\n KeyPhrasesOptionalParams as GeneratedExtractKeyPhrasesOptions,\n EntitiesRecognitionGeneralOptionalParams as GeneratedRecognizeCategorizedEntitiesOptions,\n EntitiesLinkingOptionalParams as GeneratedRecognizeLinkedEntitiesOptions,\n EntitiesRecognitionPiiOptionalParams as GeneratedRecognizePiiEntitiesOptions,\n PiiCategory,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { DetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport { makeDetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport {\n StringIndexType,\n addParamsToTask,\n compose,\n setCategoriesFilter,\n setOpinionMining,\n setStrEncodingParam,\n setStrEncodingParamValue,\n throwError,\n} from \"./util.js\";\nimport {\n AnalyzeHealthcareEntitiesPollerLike,\n BeginAnalyzeHealthcarePoller,\n PollerLikeWithCancellation,\n} from \"./lro/health/poller.js\";\nimport {\n AnalyzeHealthcareOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n} from \"./lro/health/operation.js\";\nimport type { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions.js\";\nimport { AnalyzeActionsPollerLike, BeginAnalyzeActionsPoller } from \"./lro/analyze/poller.js\";\nimport {\n AnalyzeActionsOperationMetadata,\n AnalyzeActionsOperationState,\n BeginAnalyzeActionsOptions,\n} from \"./lro/analyze/operation.js\";\nimport { AnalysisPollOperationState, OperationMetadata } from \"./lro/poller.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\nexport {\n BeginAnalyzeActionsOptions,\n AnalyzeActionsPollerLike,\n AnalyzeActionsOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n PollerLikeWithCancellation,\n AnalyzeHealthcareEntitiesPollerLike,\n AnalyzeHealthcareOperationState,\n AnalysisPollOperationState,\n OperationMetadata,\n AnalyzeActionsOperationMetadata,\n StringIndexType,\n};\n\nconst DEFAULT_COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\";\n\n/**\n * Client options used to configure TextAnalytics API requests.\n */\nexport interface TextAnalyticsClientOptions extends CommonClientOptions {\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n defaultCountryHint?: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n defaultLanguage?: string;\n}\n\n/**\n * Options for the detect languages operation.\n */\nexport interface DetectLanguageOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize entities operation.\n */\nexport interface RecognizeCategorizedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for the analyze sentiment operation.\n */\nexport interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * The types of PII domains the user can choose from.\n */\nexport enum PiiEntityDomain {\n /**\n * @see {@link https://aka.ms/tanerpii} for more information.\n */\n PROTECTED_HEALTH_INFORMATION = \"PHI\",\n}\n\n/**\n * Options for the recognize PII entities operation.\n */\nexport interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n}\n\n/**\n * Options for the extract key phrases operation.\n */\nexport interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize linked entities operation.\n */\nexport interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for an entities recognition action.\n */\nexport interface RecognizeCategorizedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a Pii entities recognition action.\n */\nexport interface RecognizePiiEntitiesAction extends TextAnalyticsAction {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a key phrases recognition action.\n */\nexport interface ExtractKeyPhrasesAction extends TextAnalyticsAction {\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an entities linking action.\n */\nexport interface RecognizeLinkedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an analyze sentiment action.\n */\nexport interface AnalyzeSentimentAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n}\n\n/**\n * Description of collection of actions for the analyze API to perform on input documents. However, currently, the service can accept up to one action only per action type.\n */\nexport interface TextAnalyticsActions {\n /**\n * A collection of descriptions of entities recognition actions. However, currently, the service can accept up to one action only for `recognizeEntities`.\n */\n recognizeEntitiesActions?: RecognizeCategorizedEntitiesAction[];\n /**\n * A collection of descriptions of Pii entities recognition actions. However, currently, the service can accept up to one action only for `recognizePiiEntities`.\n */\n recognizePiiEntitiesActions?: RecognizePiiEntitiesAction[];\n /**\n * A collection of descriptions of key phrases recognition actions. However, currently, the service can accept up to one action only for `extractKeyPhrases`.\n */\n extractKeyPhrasesActions?: ExtractKeyPhrasesAction[];\n /**\n * A collection of descriptions of entities linking actions. However, currently, the service can accept up to one action only for `recognizeLinkedEntities`.\n */\n recognizeLinkedEntitiesActions?: RecognizeLinkedEntitiesAction[];\n /**\n * A collection of descriptions of sentiment analysis actions. However, currently, the service can accept up to one action only for `analyzeSentiment`.\n */\n analyzeSentimentActions?: AnalyzeSentimentAction[];\n}\n/**\n * Client class for interacting with Azure Text Analytics.\n */\nexport class TextAnalyticsClient {\n /**\n * The URL to the TextAnalytics endpoint\n */\n public readonly endpointUrl: string;\n\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n public defaultCountryHint: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n public defaultLanguage: string;\n\n /**\n * @internal\n * A reference to the auto-generated TextAnalytics HTTP client.\n */\n private readonly client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Creates an instance of TextAnalyticsClient.\n *\n * Example usage:\n * ```ts\n * import { TextAnalyticsClient, AzureKeyCredential } from \"@azure/ai-text-analytics\";\n *\n * const client = new TextAnalyticsClient(\n * \"<service endpoint>\",\n * new AzureKeyCredential(\"<api key>\")\n * );\n * ```\n * @param endpointUrl - The URL to the TextAnalytics endpoint\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalyticsClientOptions = {},\n ) {\n this.endpointUrl = endpointUrl;\n const { defaultCountryHint = \"us\", defaultLanguage = \"en\", ...pipelineOptions } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;\n if (!pipelineOptions.userAgentOptions) {\n pipelineOptions.userAgentOptions = {};\n }\n if (pipelineOptions.userAgentOptions.userAgentPrefix) {\n pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n };\n\n this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-text-analytics\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input strings to analyze.\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the text analytics model in predicting\n * the language they are written in. If unspecified, this value will be\n * set to the default country hint in `TextAnalyticsClientOptions`.\n * If set to an empty string, or the string \"none\", the service will apply a\n * model where the country is explicitly unset.\n * The same country hint is applied to all strings in the input collection.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: string[],\n countryHint?: string,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input document are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: DetectLanguageInput[],\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n public async detectLanguage(\n documents: string[] | DetectLanguageInput[],\n countryHintOrOptions?: string | DetectLanguageOptions,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray> {\n let realOptions: DetectLanguageOptions;\n let realInputs: DetectLanguageInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const countryHint = (countryHintOrOptions as string) || this.defaultCountryHint;\n realInputs = convertToDetectLanguageInput(documents, countryHint);\n realOptions = options || {};\n } else {\n // Replace \"none\" hints with \"\"\n realInputs = documents.map((input) => ({\n ...input,\n countryHint: input.countryHint === \"none\" ? \"\" : input.countryHint,\n }));\n realOptions = (countryHintOrOptions as DetectLanguageOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-detectLanguages\",\n makeGeneratedDetectLanguageOptions(realOptions),\n (finalOptions) =>\n this.client\n .languages(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeDetectLanguageResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input strings, and categorize those entities into types\n * such as person, location, or organization. For more information on \n * available categories, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: string[],\n language?: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input documents, and categorize those entities into types\n * such as person, location, or organization. For more information on\n * available categories, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: TextDocumentInput[],\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n public async recognizeEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeCategorizedEntitiesOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray> {\n let realOptions: RecognizeCategorizedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeCategorizedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeEntities\",\n makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions),\n (finalOptions) =>\n throwError(\n this.client.entitiesRecognitionGeneral(\n {\n documents: realInputs,\n },\n finalOptions,\n ),\n ).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify the positive, negative, neutral, or mixed\n * sentiment contained in the input strings, as well as scores indicating\n * the model's confidence in each of the predicted sentiments. Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the lanuage is explicitly set to \"None\".\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: string[],\n language?: string,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n /**\n * Runs a predictive model to identify the positive, negative or neutral, or mixed\n * sentiment contained in the input documents, as well as scores indicating\n * the model's confidence in each of the predicted sentiments.Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: TextDocumentInput[],\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n public async analyzeSentiment(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | AnalyzeSentimentOptions,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray> {\n let realOptions: AnalyzeSentimentOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as AnalyzeSentimentOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-analyzeSentiment\",\n makeGeneratedAnalyzeSentimentOptions(realOptions),\n (finalOptions) =>\n this.client\n .sentiment(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeAnalyzeSentimentResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input strings.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: string[],\n language?: string,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input documents.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: TextDocumentInput[],\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n public async extractKeyPhrases(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | ExtractKeyPhrasesOptions,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray> {\n let realOptions: ExtractKeyPhrasesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as ExtractKeyPhrasesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-extractKeyPhrases\",\n makeGeneratedExtractKeyPhrasesOptions(realOptions),\n (finalOptions) =>\n this.client\n .keyPhrases(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeExtractKeyPhrasesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input strings,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizePiiEntities(\n inputs: string[],\n language?: string,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input documents,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizePiiEntities(\n inputs: TextDocumentInput[],\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n public async recognizePiiEntities(\n inputs: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizePiiEntitiesOptions,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray> {\n let realOptions: RecognizePiiEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (isStringArray(inputs)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(inputs, language);\n realOptions = options || {};\n } else {\n realInputs = inputs;\n realOptions = (languageOrOptions as RecognizePiiEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizePiiEntities\",\n makeGeneratedRecognizePiiEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesRecognitionPii(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizePiiEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input strings, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: string[],\n language?: string,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input documents, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://docs.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: TextDocumentInput[],\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n public async recognizeLinkedEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeLinkedEntitiesOptions,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray> {\n let realOptions: RecognizeLinkedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeLinkedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeLinkedEntities\",\n makeGeneratedRecognizeLinkingEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesLinking(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizeLinkedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: string[],\n language?: string,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n\n async beginAnalyzeHealthcareEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | BeginAnalyzeHealthcareEntitiesOptions,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike> {\n let realOptions: BeginAnalyzeHealthcareEntitiesOptions;\n let realInputs: TextDocumentInput[];\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeHealthcareEntitiesOptions) || {};\n }\n\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeHealthcarePoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n options: restOptions,\n updateIntervalInMs: updateIntervalInMs,\n resumeFrom: resumeFrom,\n });\n\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: string[],\n actions: TextAnalyticsActions,\n language?: string,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: TextAnalyticsActions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n public async beginAnalyzeActions(\n documents: string[] | TextDocumentInput[],\n actions: TextAnalyticsActions,\n languageOrOptions?: string | BeginAnalyzeActionsOptions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike> {\n let realOptions: BeginAnalyzeActionsOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeActionsOptions) || {};\n }\n const compiledActions = compileAnalyzeInput(actions);\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeActionsPoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n actions: compiledActions,\n options: restOptions,\n resumeFrom: resumeFrom,\n updateIntervalInMs: updateIntervalInMs,\n });\n\n await poller.poll();\n return poller;\n }\n}\n\n/**\n * @internal\n */\nfunction compileAnalyzeInput(actions: TextAnalyticsActions): GeneratedActions {\n return {\n entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(\n compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask)),\n ),\n entityRecognitionTasks: actions.recognizeEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),\n entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(\n compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask)),\n ),\n };\n}\n\nfunction isStringArray(documents: any[]): documents is string[] {\n return typeof documents[0] === \"string\";\n}\n\n/**\n * @internal\n */\nfunction convertToDetectLanguageInput(\n inputs: string[],\n countryHint: string,\n): DetectLanguageInput[] {\n if (countryHint === \"none\") {\n countryHint = \"\";\n }\n return inputs.map((text: string, index): DetectLanguageInput => {\n return {\n id: String(index),\n countryHint,\n text,\n };\n });\n}\n\n/**\n * @internal\n */\nfunction convertToTextDocumentInput(inputs: string[], language: string): TextDocumentInput[] {\n return inputs.map((text: string, index): TextDocumentInput => {\n return {\n id: String(index),\n language,\n text,\n };\n });\n}\n\n/**\n * Creates the options the service expects for the analyze sentiment API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedAnalyzeSentimentOptions(\n params: AnalyzeSentimentOptions,\n): GeneratedAnalyzeSentimentOptions {\n return {\n abortSignal: params.abortSignal,\n opinionMining: params.includeOpinionMining,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize pii entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizePiiEntitiesOptions(\n params: RecognizePiiEntitiesOptions,\n): GeneratedRecognizePiiEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n domain: params.domainFilter,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n piiCategories: params.categoriesFilter,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeCategorizedEntitiesOptions(\n params: RecognizeCategorizedEntitiesOptions,\n): GeneratedRecognizeCategorizedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the detect language API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedDetectLanguageOptions(\n params: DetectLanguageOptions,\n): GeneratedDetectLanguageOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the extract key phrases API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedExtractKeyPhrasesOptions(\n params: ExtractKeyPhrasesOptions,\n): GeneratedExtractKeyPhrasesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize linked entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeLinkingEntitiesOptions(\n params: RecognizeLinkedEntitiesOptions,\n): GeneratedRecognizeLinkedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n };\n}\n"]}
1
+ {"version":3,"file":"textAnalyticsClient.js","sourceRoot":"","sources":["../../src/textAnalyticsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAAE,2CAA2C,EAAE,MAAM,8CAA8C,CAAC;AAE3G,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AAEjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;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,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,aAAa,EAAE,MAAM,CAAC,kBAAkB;QACxC,eAAe,EAAE,wBAAwB,CAAC,MAAM,CAAC,eAAe,CAAC;KAClE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\nimport type {\n DetectLanguageInput,\n JobManifestTasks as GeneratedActions,\n SentimentOptionalParams as GeneratedAnalyzeSentimentOptions,\n LanguagesOptionalParams as GeneratedDetectLanguageOptions,\n KeyPhrasesOptionalParams as GeneratedExtractKeyPhrasesOptions,\n EntitiesRecognitionGeneralOptionalParams as GeneratedRecognizeCategorizedEntitiesOptions,\n EntitiesLinkingOptionalParams as GeneratedRecognizeLinkedEntitiesOptions,\n EntitiesRecognitionPiiOptionalParams as GeneratedRecognizePiiEntitiesOptions,\n PiiCategory,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { DetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport { makeDetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport {\n StringIndexType,\n addParamsToTask,\n compose,\n setCategoriesFilter,\n setOpinionMining,\n setStrEncodingParam,\n setStrEncodingParamValue,\n throwError,\n} from \"./util.js\";\nimport {\n AnalyzeHealthcareEntitiesPollerLike,\n BeginAnalyzeHealthcarePoller,\n PollerLikeWithCancellation,\n} from \"./lro/health/poller.js\";\nimport {\n AnalyzeHealthcareOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n} from \"./lro/health/operation.js\";\nimport type { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions.js\";\nimport { AnalyzeActionsPollerLike, BeginAnalyzeActionsPoller } from \"./lro/analyze/poller.js\";\nimport {\n AnalyzeActionsOperationMetadata,\n AnalyzeActionsOperationState,\n BeginAnalyzeActionsOptions,\n} from \"./lro/analyze/operation.js\";\nimport { AnalysisPollOperationState, OperationMetadata } from \"./lro/poller.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\nexport {\n BeginAnalyzeActionsOptions,\n AnalyzeActionsPollerLike,\n AnalyzeActionsOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n PollerLikeWithCancellation,\n AnalyzeHealthcareEntitiesPollerLike,\n AnalyzeHealthcareOperationState,\n AnalysisPollOperationState,\n OperationMetadata,\n AnalyzeActionsOperationMetadata,\n StringIndexType,\n};\n\nconst DEFAULT_COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\";\n\n/**\n * Client options used to configure TextAnalytics API requests.\n */\nexport interface TextAnalyticsClientOptions extends CommonClientOptions {\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n defaultCountryHint?: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n defaultLanguage?: string;\n}\n\n/**\n * Options for the detect languages operation.\n */\nexport interface DetectLanguageOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize entities operation.\n */\nexport interface RecognizeCategorizedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for the analyze sentiment operation.\n */\nexport interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * The types of PII domains the user can choose from.\n */\nexport enum PiiEntityDomain {\n /**\n * @see {@link https://aka.ms/tanerpii} for more information.\n */\n PROTECTED_HEALTH_INFORMATION = \"PHI\",\n}\n\n/**\n * Options for the recognize PII entities operation.\n */\nexport interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n}\n\n/**\n * Options for the extract key phrases operation.\n */\nexport interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize linked entities operation.\n */\nexport interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for an entities recognition action.\n */\nexport interface RecognizeCategorizedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a Pii entities recognition action.\n */\nexport interface RecognizePiiEntitiesAction extends TextAnalyticsAction {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a key phrases recognition action.\n */\nexport interface ExtractKeyPhrasesAction extends TextAnalyticsAction {\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an entities linking action.\n */\nexport interface RecognizeLinkedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an analyze sentiment action.\n */\nexport interface AnalyzeSentimentAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n}\n\n/**\n * Description of collection of actions for the analyze API to perform on input documents. However, currently, the service can accept up to one action only per action type.\n */\nexport interface TextAnalyticsActions {\n /**\n * A collection of descriptions of entities recognition actions. However, currently, the service can accept up to one action only for `recognizeEntities`.\n */\n recognizeEntitiesActions?: RecognizeCategorizedEntitiesAction[];\n /**\n * A collection of descriptions of Pii entities recognition actions. However, currently, the service can accept up to one action only for `recognizePiiEntities`.\n */\n recognizePiiEntitiesActions?: RecognizePiiEntitiesAction[];\n /**\n * A collection of descriptions of key phrases recognition actions. However, currently, the service can accept up to one action only for `extractKeyPhrases`.\n */\n extractKeyPhrasesActions?: ExtractKeyPhrasesAction[];\n /**\n * A collection of descriptions of entities linking actions. However, currently, the service can accept up to one action only for `recognizeLinkedEntities`.\n */\n recognizeLinkedEntitiesActions?: RecognizeLinkedEntitiesAction[];\n /**\n * A collection of descriptions of sentiment analysis actions. However, currently, the service can accept up to one action only for `analyzeSentiment`.\n */\n analyzeSentimentActions?: AnalyzeSentimentAction[];\n}\n/**\n * Client class for interacting with Azure Text Analytics.\n */\nexport class TextAnalyticsClient {\n /**\n * The URL to the TextAnalytics endpoint\n */\n public readonly endpointUrl: string;\n\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n public defaultCountryHint: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n public defaultLanguage: string;\n\n /**\n * @internal\n * A reference to the auto-generated TextAnalytics HTTP client.\n */\n private readonly client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Creates an instance of TextAnalyticsClient.\n *\n * Example usage:\n * ```ts\n * import { TextAnalyticsClient, AzureKeyCredential } from \"@azure/ai-text-analytics\";\n *\n * const client = new TextAnalyticsClient(\n * \"<service endpoint>\",\n * new AzureKeyCredential(\"<api key>\")\n * );\n * ```\n * @param endpointUrl - The URL to the TextAnalytics endpoint\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalyticsClientOptions = {},\n ) {\n this.endpointUrl = endpointUrl;\n const { defaultCountryHint = \"us\", defaultLanguage = \"en\", ...pipelineOptions } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;\n if (!pipelineOptions.userAgentOptions) {\n pipelineOptions.userAgentOptions = {};\n }\n if (pipelineOptions.userAgentOptions.userAgentPrefix) {\n pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n };\n\n this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-text-analytics\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input strings to analyze.\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the text analytics model in predicting\n * the language they are written in. If unspecified, this value will be\n * set to the default country hint in `TextAnalyticsClientOptions`.\n * If set to an empty string, or the string \"none\", the service will apply a\n * model where the country is explicitly unset.\n * The same country hint is applied to all strings in the input collection.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: string[],\n countryHint?: string,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input document are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: DetectLanguageInput[],\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n public async detectLanguage(\n documents: string[] | DetectLanguageInput[],\n countryHintOrOptions?: string | DetectLanguageOptions,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray> {\n let realOptions: DetectLanguageOptions;\n let realInputs: DetectLanguageInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const countryHint = (countryHintOrOptions as string) || this.defaultCountryHint;\n realInputs = convertToDetectLanguageInput(documents, countryHint);\n realOptions = options || {};\n } else {\n // Replace \"none\" hints with \"\"\n realInputs = documents.map((input) => ({\n ...input,\n countryHint: input.countryHint === \"none\" ? \"\" : input.countryHint,\n }));\n realOptions = (countryHintOrOptions as DetectLanguageOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-detectLanguages\",\n makeGeneratedDetectLanguageOptions(realOptions),\n (finalOptions) =>\n this.client\n .languages(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeDetectLanguageResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input strings, and categorize those entities into types\n * such as person, location, or organization. For more information on \n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: string[],\n language?: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input documents, and categorize those entities into types\n * such as person, location, or organization. For more information on\n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: TextDocumentInput[],\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n public async recognizeEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeCategorizedEntitiesOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray> {\n let realOptions: RecognizeCategorizedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeCategorizedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeEntities\",\n makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions),\n (finalOptions) =>\n throwError(\n this.client.entitiesRecognitionGeneral(\n {\n documents: realInputs,\n },\n finalOptions,\n ),\n ).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify the positive, negative, neutral, or mixed\n * sentiment contained in the input strings, as well as scores indicating\n * the model's confidence in each of the predicted sentiments. Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the lanuage is explicitly set to \"None\".\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: string[],\n language?: string,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n /**\n * Runs a predictive model to identify the positive, negative or neutral, or mixed\n * sentiment contained in the input documents, as well as scores indicating\n * the model's confidence in each of the predicted sentiments.Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: TextDocumentInput[],\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n public async analyzeSentiment(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | AnalyzeSentimentOptions,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray> {\n let realOptions: AnalyzeSentimentOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as AnalyzeSentimentOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-analyzeSentiment\",\n makeGeneratedAnalyzeSentimentOptions(realOptions),\n (finalOptions) =>\n this.client\n .sentiment(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeAnalyzeSentimentResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input strings.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: string[],\n language?: string,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input documents.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: TextDocumentInput[],\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n public async extractKeyPhrases(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | ExtractKeyPhrasesOptions,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray> {\n let realOptions: ExtractKeyPhrasesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as ExtractKeyPhrasesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-extractKeyPhrases\",\n makeGeneratedExtractKeyPhrasesOptions(realOptions),\n (finalOptions) =>\n this.client\n .keyPhrases(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeExtractKeyPhrasesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input strings,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizePiiEntities(\n inputs: string[],\n language?: string,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input documents,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/en-us/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizePiiEntities(\n inputs: TextDocumentInput[],\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n public async recognizePiiEntities(\n inputs: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizePiiEntitiesOptions,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray> {\n let realOptions: RecognizePiiEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (isStringArray(inputs)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(inputs, language);\n realOptions = options || {};\n } else {\n realInputs = inputs;\n realOptions = (languageOrOptions as RecognizePiiEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizePiiEntities\",\n makeGeneratedRecognizePiiEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesRecognitionPii(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizePiiEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input strings, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: string[],\n language?: string,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input documents, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: TextDocumentInput[],\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n public async recognizeLinkedEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeLinkedEntitiesOptions,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray> {\n let realOptions: RecognizeLinkedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeLinkedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeLinkedEntities\",\n makeGeneratedRecognizeLinkingEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesLinking(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizeLinkedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: string[],\n language?: string,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n\n async beginAnalyzeHealthcareEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | BeginAnalyzeHealthcareEntitiesOptions,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike> {\n let realOptions: BeginAnalyzeHealthcareEntitiesOptions;\n let realInputs: TextDocumentInput[];\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeHealthcareEntitiesOptions) || {};\n }\n\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeHealthcarePoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n options: restOptions,\n updateIntervalInMs: updateIntervalInMs,\n resumeFrom: resumeFrom,\n });\n\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: string[],\n actions: TextAnalyticsActions,\n language?: string,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: TextAnalyticsActions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n public async beginAnalyzeActions(\n documents: string[] | TextDocumentInput[],\n actions: TextAnalyticsActions,\n languageOrOptions?: string | BeginAnalyzeActionsOptions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike> {\n let realOptions: BeginAnalyzeActionsOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeActionsOptions) || {};\n }\n const compiledActions = compileAnalyzeInput(actions);\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeActionsPoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n actions: compiledActions,\n options: restOptions,\n resumeFrom: resumeFrom,\n updateIntervalInMs: updateIntervalInMs,\n });\n\n await poller.poll();\n return poller;\n }\n}\n\n/**\n * @internal\n */\nfunction compileAnalyzeInput(actions: TextAnalyticsActions): GeneratedActions {\n return {\n entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(\n compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask)),\n ),\n entityRecognitionTasks: actions.recognizeEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),\n entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(\n compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask)),\n ),\n };\n}\n\nfunction isStringArray(documents: any[]): documents is string[] {\n return typeof documents[0] === \"string\";\n}\n\n/**\n * @internal\n */\nfunction convertToDetectLanguageInput(\n inputs: string[],\n countryHint: string,\n): DetectLanguageInput[] {\n if (countryHint === \"none\") {\n countryHint = \"\";\n }\n return inputs.map((text: string, index): DetectLanguageInput => {\n return {\n id: String(index),\n countryHint,\n text,\n };\n });\n}\n\n/**\n * @internal\n */\nfunction convertToTextDocumentInput(inputs: string[], language: string): TextDocumentInput[] {\n return inputs.map((text: string, index): TextDocumentInput => {\n return {\n id: String(index),\n language,\n text,\n };\n });\n}\n\n/**\n * Creates the options the service expects for the analyze sentiment API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedAnalyzeSentimentOptions(\n params: AnalyzeSentimentOptions,\n): GeneratedAnalyzeSentimentOptions {\n return {\n abortSignal: params.abortSignal,\n opinionMining: params.includeOpinionMining,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize pii entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizePiiEntitiesOptions(\n params: RecognizePiiEntitiesOptions,\n): GeneratedRecognizePiiEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n domain: params.domainFilter,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n piiCategories: params.categoriesFilter,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeCategorizedEntitiesOptions(\n params: RecognizeCategorizedEntitiesOptions,\n): GeneratedRecognizeCategorizedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the detect language API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedDetectLanguageOptions(\n params: DetectLanguageOptions,\n): GeneratedDetectLanguageOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the extract key phrases API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedExtractKeyPhrasesOptions(\n params: ExtractKeyPhrasesOptions,\n): GeneratedExtractKeyPhrasesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize linked entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeLinkingEntitiesOptions(\n params: RecognizeLinkedEntitiesOptions,\n): GeneratedRecognizeLinkedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n };\n}\n"]}