@azure/ai-text-analytics 5.2.0-beta.2 → 6.0.0-alpha.20220518.3

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 (103) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +375 -133
  3. package/dist/index.js +2797 -4176
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/azureKeyCredentialPolicy.js +2 -2
  6. package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -1
  7. package/dist-esm/src/constants.js +16 -0
  8. package/dist-esm/src/constants.js.map +1 -0
  9. package/dist-esm/src/generated/generatedClient.js +80 -334
  10. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  11. package/dist-esm/src/generated/index.js +1 -1
  12. package/dist-esm/src/generated/index.js.map +1 -1
  13. package/dist-esm/src/generated/models/index.js +106 -35
  14. package/dist-esm/src/generated/models/index.js.map +1 -1
  15. package/dist-esm/src/generated/models/mappers.js +1625 -2101
  16. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  17. package/dist-esm/src/generated/models/parameters.js +18 -105
  18. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  19. package/dist-esm/src/generated/operations/analyzeText.js +105 -0
  20. package/dist-esm/src/generated/operations/analyzeText.js.map +1 -0
  21. package/dist-esm/src/generated/operations/index.js +9 -0
  22. package/dist-esm/src/generated/operations/index.js.map +1 -0
  23. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js +9 -0
  24. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js.map +1 -0
  25. package/dist-esm/src/generated/operationsInterfaces/index.js +9 -0
  26. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  27. package/dist-esm/src/index.js +14 -5
  28. package/dist-esm/src/index.js.map +1 -1
  29. package/dist-esm/src/lro.js +195 -0
  30. package/dist-esm/src/lro.js.map +1 -0
  31. package/dist-esm/src/models.js +42 -0
  32. package/dist-esm/src/models.js.map +1 -0
  33. package/dist-esm/src/textAnalysisClient.js +197 -0
  34. package/dist-esm/src/textAnalysisClient.js.map +1 -0
  35. package/dist-esm/src/transforms.js +279 -0
  36. package/dist-esm/src/transforms.js.map +1 -0
  37. package/dist-esm/src/util.js +35 -141
  38. package/dist-esm/src/util.js.map +1 -1
  39. package/package.json +25 -33
  40. package/types/ai-text-analytics.d.ts +1402 -1421
  41. package/CHANGELOG.md +0 -162
  42. package/dist-esm/src/analyzeActionsResult.js +0 -205
  43. package/dist-esm/src/analyzeActionsResult.js.map +0 -1
  44. package/dist-esm/src/analyzeHealthcareEntitiesResult.js +0 -53
  45. package/dist-esm/src/analyzeHealthcareEntitiesResult.js.map +0 -1
  46. package/dist-esm/src/analyzeLro.js +0 -132
  47. package/dist-esm/src/analyzeLro.js.map +0 -1
  48. package/dist-esm/src/analyzeSentimentResult.js +0 -74
  49. package/dist-esm/src/analyzeSentimentResult.js.map +0 -1
  50. package/dist-esm/src/analyzeSentimentResultArray.js +0 -11
  51. package/dist-esm/src/analyzeSentimentResultArray.js.map +0 -1
  52. package/dist-esm/src/detectLanguageResult.js +0 -17
  53. package/dist-esm/src/detectLanguageResult.js.map +0 -1
  54. package/dist-esm/src/detectLanguageResultArray.js +0 -11
  55. package/dist-esm/src/detectLanguageResultArray.js.map +0 -1
  56. package/dist-esm/src/extractKeyPhrasesResult.js +0 -17
  57. package/dist-esm/src/extractKeyPhrasesResult.js.map +0 -1
  58. package/dist-esm/src/extractKeyPhrasesResultArray.js +0 -11
  59. package/dist-esm/src/extractKeyPhrasesResultArray.js.map +0 -1
  60. package/dist-esm/src/extractSummaryResult.js +0 -17
  61. package/dist-esm/src/extractSummaryResult.js.map +0 -1
  62. package/dist-esm/src/extractSummaryResultArray.js +0 -11
  63. package/dist-esm/src/extractSummaryResultArray.js.map +0 -1
  64. package/dist-esm/src/generated/generatedClientContext.js +0 -42
  65. package/dist-esm/src/generated/generatedClientContext.js.map +0 -1
  66. package/dist-esm/src/healthLro.js +0 -139
  67. package/dist-esm/src/healthLro.js.map +0 -1
  68. package/dist-esm/src/multiCategoryClassifyResult.js +0 -17
  69. package/dist-esm/src/multiCategoryClassifyResult.js.map +0 -1
  70. package/dist-esm/src/multiCategoryClassifyResultArray.js +0 -11
  71. package/dist-esm/src/multiCategoryClassifyResultArray.js.map +0 -1
  72. package/dist-esm/src/pollerModels.js +0 -4
  73. package/dist-esm/src/pollerModels.js.map +0 -1
  74. package/dist-esm/src/recognizeCategorizedEntitiesResult.js +0 -17
  75. package/dist-esm/src/recognizeCategorizedEntitiesResult.js.map +0 -1
  76. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js +0 -11
  77. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js.map +0 -1
  78. package/dist-esm/src/recognizeCustomEntitiesResult.js +0 -17
  79. package/dist-esm/src/recognizeCustomEntitiesResult.js.map +0 -1
  80. package/dist-esm/src/recognizeCustomEntitiesResultArray.js +0 -11
  81. package/dist-esm/src/recognizeCustomEntitiesResultArray.js.map +0 -1
  82. package/dist-esm/src/recognizeLinkedEntitiesResult.js +0 -17
  83. package/dist-esm/src/recognizeLinkedEntitiesResult.js.map +0 -1
  84. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js +0 -11
  85. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js.map +0 -1
  86. package/dist-esm/src/recognizePiiEntitiesResult.js +0 -18
  87. package/dist-esm/src/recognizePiiEntitiesResult.js.map +0 -1
  88. package/dist-esm/src/recognizePiiEntitiesResultArray.js +0 -11
  89. package/dist-esm/src/recognizePiiEntitiesResultArray.js.map +0 -1
  90. package/dist-esm/src/singleCategoryClassifyResult.js +0 -17
  91. package/dist-esm/src/singleCategoryClassifyResult.js.map +0 -1
  92. package/dist-esm/src/singleCategoryClassifyResultArray.js +0 -11
  93. package/dist-esm/src/singleCategoryClassifyResultArray.js.map +0 -1
  94. package/dist-esm/src/textAnalyticsAction.js +0 -4
  95. package/dist-esm/src/textAnalyticsAction.js.map +0 -1
  96. package/dist-esm/src/textAnalyticsClient.js +0 -511
  97. package/dist-esm/src/textAnalyticsClient.js.map +0 -1
  98. package/dist-esm/src/textAnalyticsOperationOptions.js +0 -4
  99. package/dist-esm/src/textAnalyticsOperationOptions.js.map +0 -1
  100. package/dist-esm/src/textAnalyticsResult.js +0 -94
  101. package/dist-esm/src/textAnalyticsResult.js.map +0 -1
  102. package/dist-esm/src/tracing.js +0 -12
  103. package/dist-esm/src/tracing.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeLro.js","sourceRoot":"","sources":["../../src/analyzeLro.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAmC,MAAM,oBAAoB,CAAC;AAQvF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACL,MAAM,EACN,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,GAAG,EACJ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAe,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAEL,0BAA0B,EAE3B,MAAM,wBAAwB,CAAC;AA6DhC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAEhE,wDAAwD;AACxD,MAAM,0BAA0B,GAAkB;IAChD,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,eAAe;SACpC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,eAAe,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE,IAAI,CAAC;I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Y,EAAE,SAAS,CAAC;oBACzD,YAAY,EAAE,YAAY,CAAC,QAAQ;iBACpC,CAAC;YACJ,CAAC;SACF,CAAC;QACF,MAAM,aAAa,GAAG,qBAAqB,CACzC,WAAW,CACZ,CAAC;QACF,oDAAoD;QACpD,yDAAyD;QACzD,gDAAgD;QAChD,2CAA2C;QAC3C,MAAM;QACN,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAmC,EACnC,YAAyB;IAEzB,MAAM,QAAQ,GAAG,YAAY,CAAC,IAA4C,CAAC;IAC3E,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,eAAe,CAAC;IAC3C,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IACnD,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IAC9C,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/B,KAAK,CAAC,qBAAqB,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;IACvD,KAAK,CAAC,kBAAkB,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;IACjD,KAAK,CAAC,sBAAsB,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;IACzD,KAAK,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { LongRunningOperation, LroResponse, PollerLike, RawResponse } from \"@azure/core-lro\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { createSerializer, OperationOptions, OperationSpec } from \"@azure/core-client\";\nimport {\n GeneratedClient,\n GeneratedClientAnalyzeStatusOptionalParams,\n GeneratedClientAnalyzeStatusResponse,\n JobManifestTasks,\n TextDocumentInput\n} from \"./generated\";\nimport { createSpan } from \"./tracing\";\nimport { compileError, getRawResponse, sendGetRequest } from \"./util\";\nimport * as Mappers from \"./generated/models/mappers\";\nimport {\n accept,\n apiVersion,\n endpoint,\n includeStatistics,\n skip,\n top\n} from \"./generated/models/parameters\";\nimport { getPagedAsyncIterator, PagedResult } from \"@azure/core-paging\";\nimport { AnalysisPollOperationState, OperationMetadata } from \"./pollerModels\";\nimport {\n AnalyzeActionsResult,\n createAnalyzeActionsResult,\n PagedAnalyzeActionsResult\n} from \"./analyzeActionsResult\";\n\n/**\n * Options for the begin analyze actions operation.\n */\nexport interface BeginAnalyzeActionsOptions extends OperationOptions {\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 * If set to true, response will contain input and document level statistics.\n */\n includeStatistics?: boolean;\n /**\n * The operation's display name.\n */\n displayName?: string;\n}\n\n/**\n * Result type of the Begin Analyze Actions Long-Running-Operation (LRO).\n */\nexport type AnalyzeActionsPollerLike = PollerLike<\n AnalyzeActionsOperationState,\n PagedAnalyzeActionsResult\n>;\n\n/**\n * The metadata for beginAnalyzeActions operations.\n */\nexport interface AnalyzeActionsOperationMetadata extends OperationMetadata {\n /**\n * Number of successfully completed actions.\n */\n actionsSucceededCount: number;\n /**\n * Number of failed actions.\n */\n actionsFailedCount: number;\n /**\n * Number of actions still in progress.\n */\n actionsInProgressCount: number;\n /**\n * The operation's display name.\n */\n displayName?: string;\n}\n\n/**\n * The state of the begin analyze polling operation.\n */\nexport interface AnalyzeActionsOperationState\n extends AnalysisPollOperationState<PagedAnalyzeActionsResult>,\n AnalyzeActionsOperationMetadata {}\n\nconst serializer = createSerializer(Mappers, /* isXml */ false);\n\n// Consider whether the spec can be exported by code gen\nconst analyzeStatusOperationSpec: OperationSpec = {\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [includeStatistics, top, skip],\n urlParameters: [endpoint, apiVersion],\n headerParameters: [accept],\n serializer\n};\n\n/**\n * @internal\n */\nexport class AnalyzeLro implements LongRunningOperation<PagedAnalyzeActionsResult> {\n public requestMethod = \"POST\";\n public requestPath = \"/analyze\";\n constructor(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: GeneratedClient,\n private baseOptions: OperationOptions,\n private initOptions: {\n displayName?: string;\n },\n private pollOptions: {\n includeStatistics?: boolean;\n },\n private documents: TextDocumentInput[],\n private tasks: JobManifestTasks\n ) {}\n async sendInitialRequest(): Promise<LroResponse<PagedAnalyzeActionsResult>> {\n const { span, updatedOptions: finalOptions } = createSpan(\"TextAnalyticsClient-beginAnalyze\", {\n ...this.baseOptions,\n ...this.initOptions\n });\n try {\n const { flatResponse, rawResponse } = await getRawResponse(\n (paramOptions) =>\n this.client.analyze({\n body: {\n analysisInput: { documents: this.documents },\n tasks: this.tasks,\n displayName: this.initOptions.displayName\n },\n ...paramOptions\n }),\n finalOptions\n );\n return {\n flatResponse: flatResponse as PagedAnalyzeActionsResult,\n rawResponse\n };\n } catch (e) {\n const exception = compileError(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: exception.message\n });\n throw exception;\n } finally {\n span.end();\n }\n }\n async sendPollRequest(path: string): Promise<LroResponse<PagedAnalyzeActionsResult>> {\n return sendGetRequest(\n this.client,\n analyzeStatusOperationSpec,\n \"AnalyzeStatus\",\n { ...this.baseOptions, ...this.pollOptions },\n path\n ) as Promise<LroResponse<PagedAnalyzeActionsResult>>;\n }\n}\n\n/**\n * @internal\n */\nexport function isAnalyzeDone(response: unknown): boolean {\n const castResponse = response as GeneratedClientAnalyzeStatusResponse;\n switch (castResponse.status) {\n case \"notStarted\":\n case \"running\":\n return false;\n default: {\n return true;\n }\n }\n}\n\n/**\n * @internal\n */\nexport function processAnalyzeResult(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n client: GeneratedClient,\n documents: TextDocumentInput[],\n options: GeneratedClientAnalyzeStatusOptionalParams\n): (result: unknown, state: AnalyzeActionsOperationState) => PagedAnalyzeActionsResult {\n return (_result: unknown, state: AnalyzeActionsOperationState): PagedAnalyzeActionsResult => {\n const pollingURL = (state as any).pollingURL;\n const pagedResult: PagedResult<AnalyzeActionsResult> = {\n firstPageLink: pollingURL,\n getPage: async (pageLink: string, maxPageSize?: number) => {\n const response = await sendGetRequest(\n client,\n analyzeStatusOperationSpec,\n \"AnalyzeStatus\",\n // if `top` is set to `undefined`, the default value will not be sent\n // as part of the request.\n maxPageSize ? { ...options, top: maxPageSize } : options,\n pageLink\n );\n const flatResponse = response.flatResponse as GeneratedClientAnalyzeStatusResponse;\n return {\n page: createAnalyzeActionsResult(flatResponse, documents),\n nextPageLink: flatResponse.nextLink\n };\n }\n };\n const pagedIterator = getPagedAsyncIterator<AnalyzeActionsResult, AnalyzeActionsResult>(\n pagedResult\n );\n // Attach stats if the service starts to return them\n // https://github.com/Azure/azure-sdk-for-js/issues/14139\n // state.result = Object.assign(pagedIterator, {\n // statistics: operationStatus.statistics\n // });\n return pagedIterator;\n };\n}\n\n/**\n * @internal\n */\nexport function updateAnalyzeState(\n state: AnalyzeActionsOperationState,\n lastResponse: RawResponse\n): void {\n const response = lastResponse.body as GeneratedClientAnalyzeStatusResponse;\n state.createdOn = response.createdDateTime;\n state.lastModifiedOn = response.lastUpdateDateTime;\n state.expiresOn = response.expirationDateTime;\n state.status = response.status;\n state.actionsSucceededCount = response.tasks.completed;\n state.actionsFailedCount = response.tasks.failed;\n state.actionsInProgressCount = response.tasks.inProgress;\n state.displayName = response.displayName;\n}\n"]}
@@ -1,74 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- import { parseAssessmentIndex } from "./util";
5
- /**
6
- * @param document - A document result coming from the service.
7
- * @internal
8
- */
9
- export function makeAnalyzeSentimentResult(result) {
10
- const { id, sentiment, confidenceScores, sentenceSentiments: sentences, warnings, statistics } = result;
11
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { sentiment,
12
- confidenceScores, sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)) });
13
- }
14
- /**
15
- * @internal
16
- */
17
- export function makeAnalyzeSentimentErrorResult(id, error) {
18
- return makeTextAnalyticsErrorResult(id, error);
19
- }
20
- /**
21
- * Converts a sentence sentiment object returned by the service to another that
22
- * is user-friendly.
23
- *
24
- * @param sentence - The sentence sentiment object to be converted.
25
- * @param response - The entire response returned by the service.
26
- * @returns The user-friendly sentence sentiment object.
27
- * @internal
28
- */
29
- function convertGeneratedSentenceSentiment(sentence, result) {
30
- return {
31
- confidenceScores: sentence.confidenceScores,
32
- sentiment: sentence.sentiment,
33
- text: sentence.text,
34
- offset: sentence.offset,
35
- length: sentence.length,
36
- opinions: sentence.targets
37
- ? sentence.targets.map((target) => ({
38
- target: {
39
- confidenceScores: target.confidenceScores,
40
- sentiment: target.sentiment,
41
- text: target.text,
42
- offset: target.offset,
43
- length: target.length
44
- },
45
- assessments: target.relations
46
- .filter((relation) => relation.relationType === "assessment")
47
- .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result))
48
- }))
49
- : []
50
- };
51
- }
52
- /**
53
- * Converts a target relation object returned by the service to an assessment
54
- * sentiment object where JSON pointers in the former are realized in the
55
- * latter.
56
- *
57
- * @param targetRelation - The target relation object to be converted.
58
- * @param response - The entire response returned by the service.
59
- * @returns The user-friendly assessment sentiment object.
60
- * @internal
61
- */
62
- function convertTargetRelationToAssessmentSentiment(targetRelation, result) {
63
- var _a, _b;
64
- const assessmentPtr = targetRelation.ref;
65
- const assessmentIndex = parseAssessmentIndex(assessmentPtr);
66
- const assessment = (_b = (_a = result.sentenceSentiments) === null || _a === void 0 ? void 0 : _a[assessmentIndex.sentence].assessments) === null || _b === void 0 ? void 0 : _b[assessmentIndex.assessment];
67
- if (assessment !== undefined) {
68
- return assessment;
69
- }
70
- else {
71
- throw new Error(`Pointer "${assessmentPtr}" is not a valid Assessment pointer`);
72
- }
73
- }
74
- //# sourceMappingURL=analyzeSentimentResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeSentimentResult.js","sourceRoot":"","sources":["../../src/analyzeSentimentResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAc/B,OAAO,EAAmB,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAuH/D;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAyB;IAEzB,MAAM,EACJ,EAAE,EACF,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAAE,SAAS,EAC7B,QAAQ,EACR,UAAU,EACX,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;AACH,MAAM,UAAU,+BAA+B,CAC7C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,iCAAiC,CACxC,QAAoC,EACpC,MAAyB;IAEzB,OAAO;QACL,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,QAAQ,EAAE,QAAQ,CAAC,OAAO;YACxB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAClB,CAAC,MAAsB,EAAW,EAAE,CAAC,CAAC;gBACpC,MAAM,EAAE;oBACN,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;oBACzC,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB;gBACD,WAAW,EAAE,MAAM,CAAC,SAAS;qBAC1B,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,KAAK,YAAY,CAAC;qBAC5D,GAAG,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;QAC5B,OAAO,UAAU,CAAC;KACnB;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,YAAY,aAAa,qCAAqC,CAAC,CAAC;KACjF;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport {\n TextAnalyticsError,\n DocumentSentimentLabel,\n SentimentConfidenceScores,\n SentenceSentiment as GeneratedSentenceSentiment,\n SentenceSentimentLabel,\n DocumentSentiment,\n SentenceTarget,\n TargetRelation,\n SentenceAssessment,\n TokenSentimentValue as SentenceTargetSentiment,\n TargetConfidenceScoreLabel\n} from \"./generated/models\";\nimport { AssessmentIndex, parseAssessmentIndex } from \"./util\";\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,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeAnalyzeSentimentErrorResult, makeAnalyzeSentimentResult } from "./analyzeSentimentResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeAnalyzeSentimentResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeAnalyzeSentimentResult, makeAnalyzeSentimentErrorResult);
10
- }
11
- //# sourceMappingURL=analyzeSentimentResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeSentimentResultArray.js","sourceRoot":"","sources":["../../src/analyzeSentimentResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,+BAA+B,CAC7C,KAA0B,EAC1B,QAA2B;IAE3B,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,0BAA0B,EAC1B,+BAA+B,CAChC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentBatchStatistics,\n TextDocumentInput,\n SentimentResponse\n} from \"./generated/models\";\nimport {\n AnalyzeSentimentResult,\n makeAnalyzeSentimentErrorResult,\n makeAnalyzeSentimentResult\n} from \"./analyzeSentimentResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `AnalyzeSentimentResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface AnalyzeSentimentResultArray extends Array<AnalyzeSentimentResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeAnalyzeSentimentResultArray(\n input: TextDocumentInput[],\n response: SentimentResponse\n): AnalyzeSentimentResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeAnalyzeSentimentResult,\n makeAnalyzeSentimentErrorResult\n );\n}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeDetectLanguageResult(response) {
8
- const { id, warnings, statistics, detectedLanguage } = response;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { primaryLanguage: detectedLanguage });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeDetectLanguageErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=detectLanguageResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectLanguageResult.js","sourceRoot":"","sources":["../../src/detectLanguageResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAwB/B;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAA0B;IACjE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,QAAQ,CAAC;IAChE,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,eAAe,EAAE,gBAAgB,IACjC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport { DetectedLanguage, TextAnalyticsError, DocumentLanguage } from \"./generated/models\";\n\n/**\n * The result of the detect language operation on a single document.\n */\nexport type DetectLanguageResult = DetectLanguageSuccessResult | DetectLanguageErrorResult;\n\n/**\n * The result of the detect language operation on a single document,\n * containing a prediction of what language the document is written in.\n */\nexport interface DetectLanguageSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The top detected language by confidence score.\n */\n readonly primaryLanguage: DetectedLanguage;\n}\n\n/**\n * An error result from the detect languge operation on a single document.\n */\nexport type DetectLanguageErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeDetectLanguageResult(response: DocumentLanguage): DetectLanguageSuccessResult {\n const { id, warnings, statistics, detectedLanguage } = response;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n primaryLanguage: detectedLanguage\n };\n}\n\n/**\n * @internal\n */\nexport function makeDetectLanguageErrorResult(\n id: string,\n error: TextAnalyticsError\n): DetectLanguageErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeDetectLanguageResult, makeDetectLanguageErrorResult } from "./detectLanguageResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeDetectLanguageResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeDetectLanguageResult, makeDetectLanguageErrorResult);
10
- }
11
- //# sourceMappingURL=detectLanguageResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectLanguageResultArray.js","sourceRoot":"","sources":["../../src/detectLanguageResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,wBAAwB,EACxB,6BAA6B,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAA0B,EAC1B,QAAwB;IAExB,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,wBAAwB,EACxB,6BAA6B,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TextDocumentBatchStatistics, LanguageResult, TextDocumentInput } from \"./generated/models\";\nimport {\n DetectLanguageResult,\n makeDetectLanguageResult,\n makeDetectLanguageErrorResult\n} from \"./detectLanguageResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `DetectLanguageResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface DetectLanguageResultArray extends Array<DetectLanguageResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeDetectLanguageResultArray(\n input: TextDocumentInput[],\n response: LanguageResult\n): DetectLanguageResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeDetectLanguageResult,\n makeDetectLanguageErrorResult\n );\n}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeExtractKeyPhrasesResult(result) {
8
- const { id, warnings, statistics, keyPhrases } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { keyPhrases });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeExtractKeyPhrasesErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=extractKeyPhrasesResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractKeyPhrasesResult.js","sourceRoot":"","sources":["../../src/extractKeyPhrasesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAyB/B;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAA0B;IAE1B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACxD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,UAAU,IACV;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport { TextAnalyticsError, DocumentKeyPhrases } from \"./generated/models\";\n\n/**\n * The result of the extract key phrases operation on a single document.\n */\nexport type ExtractKeyPhrasesResult = ExtractKeyPhrasesSuccessResult | ExtractKeyPhrasesErrorResult;\n\n/**\n * The result of the extract key phrases operation on a single document,\n * containing a collection of the key phrases identified in that document.\n */\nexport interface ExtractKeyPhrasesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * A list of representative words or phrases. The number of key phrases returned is proportional\n * to the number of words in the input document.\n */\n keyPhrases: string[];\n}\n\n/**\n * An error result from the extract key phrases operation on a single document.\n */\nexport type ExtractKeyPhrasesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeExtractKeyPhrasesResult(\n result: DocumentKeyPhrases\n): ExtractKeyPhrasesSuccessResult {\n const { id, warnings, statistics, keyPhrases } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n keyPhrases\n };\n}\n\n/**\n * @internal\n */\nexport function makeExtractKeyPhrasesErrorResult(\n id: string,\n error: TextAnalyticsError\n): ExtractKeyPhrasesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeExtractKeyPhrasesResult, makeExtractKeyPhrasesErrorResult } from "./extractKeyPhrasesResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeExtractKeyPhrasesResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeExtractKeyPhrasesResult, makeExtractKeyPhrasesErrorResult);
10
- }
11
- //# sourceMappingURL=extractKeyPhrasesResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractKeyPhrasesResultArray.js","sourceRoot":"","sources":["../../src/extractKeyPhrasesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,2BAA2B,EAC3B,gCAAgC,EACjC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAA0B,EAC1B,QAAyB;IAEzB,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,2BAA2B,EAC3B,gCAAgC,CACjC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentBatchStatistics,\n TextDocumentInput,\n KeyPhraseResult\n} from \"./generated/models\";\nimport {\n ExtractKeyPhrasesResult,\n makeExtractKeyPhrasesResult,\n makeExtractKeyPhrasesErrorResult\n} from \"./extractKeyPhrasesResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `ExtractKeyPhrasesResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface ExtractKeyPhrasesResultArray extends Array<ExtractKeyPhrasesResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeExtractKeyPhrasesResultArray(\n input: TextDocumentInput[],\n response: KeyPhraseResult\n): ExtractKeyPhrasesResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeExtractKeyPhrasesResult,\n makeExtractKeyPhrasesErrorResult\n );\n}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeExtractSummaryResult(result) {
8
- const { id, warnings, statistics, sentences } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { sentences: sentences.map((sentence) => (Object.assign({}, sentence))) });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeExtractSummaryErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=extractSummaryResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractSummaryResult.js","sourceRoot":"","sources":["../../src/extractSummaryResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AA0C/B;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACvD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAmC,EAAE,EAAE,CAAC,mBAC7D,QAAQ,EACX,CAAC,IACH;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport {\n TextAnalyticsError,\n ExtractedDocumentSummary,\n ExtractedSummarySentence as GeneratedSummarySentences\n} from \"./generated/models\";\n\n/**\n * The result of the extract summary operation on a single document.\n */\nexport type ExtractSummaryResult = ExtractSummarySuccessResult | ExtractSummaryErrorResult;\n\n/**\n * The result of the extract summary operation on a single document,\n * containing a collection of the summary identified in that document.\n */\nexport interface ExtractSummarySuccessResult extends TextAnalyticsSuccessResult {\n /**\n * A list of sentences composing a summary of the input document.\n */\n sentences: SummarySentence[];\n}\n\n/**\n * An extracted sentence as part of the summary of a document.\n */\nexport interface SummarySentence {\n /** The extracted sentence text. */\n text: string;\n /** A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. */\n rankScore: number;\n /** The sentence offset from the start of the document, based on the value of the stringIndexType parameter. */\n offset: number;\n /** The length of the sentence. */\n length: number;\n}\n\n/**\n * An error result from the extract summary operation on a single document.\n */\nexport type ExtractSummaryErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeExtractSummaryResult(\n result: ExtractedDocumentSummary\n): ExtractSummarySuccessResult {\n const { id, warnings, statistics, sentences } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n sentences: sentences.map((sentence: GeneratedSummarySentences) => ({\n ...sentence\n }))\n };\n}\n\n/**\n * @internal\n */\nexport function makeExtractSummaryErrorResult(\n id: string,\n error: TextAnalyticsError\n): ExtractSummaryErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeExtractSummaryResult, makeExtractSummaryErrorResult } from "./extractSummaryResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeExtractSummaryResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeExtractSummaryResult, makeExtractSummaryErrorResult);
10
- }
11
- //# sourceMappingURL=extractSummaryResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractSummaryResultArray.js","sourceRoot":"","sources":["../../src/extractSummaryResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,wBAAwB,EACxB,6BAA6B,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAA0B,EAC1B,QAAuC;IAEvC,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,wBAAwB,EACxB,6BAA6B,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentBatchStatistics,\n TextDocumentInput,\n ExtractiveSummarizationResult\n} from \"./generated/models\";\nimport {\n ExtractSummaryResult,\n makeExtractSummaryResult,\n makeExtractSummaryErrorResult\n} from \"./extractSummaryResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `ExtractSummaryResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface ExtractSummaryResultArray extends Array<ExtractSummaryResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeExtractSummaryResultArray(\n input: TextDocumentInput[],\n response: ExtractiveSummarizationResult\n): ExtractSummaryResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeExtractSummaryResult,\n makeExtractSummaryErrorResult\n );\n}\n"]}
@@ -1,42 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- import * as coreClient from "@azure/core-client";
9
- /** @internal */
10
- export class GeneratedClientContext extends coreClient.ServiceClient {
11
- /**
12
- * Initializes a new instance of the GeneratedClientContext class.
13
- * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
14
- * https://westus.api.cognitive.microsoft.com).
15
- * @param options The parameter options
16
- */
17
- constructor(endpoint, options) {
18
- if (endpoint === undefined) {
19
- throw new Error("'endpoint' cannot be null");
20
- }
21
- // Initializing default values for options
22
- if (!options) {
23
- options = {};
24
- }
25
- const defaults = {
26
- requestContentType: "application/json; charset=utf-8"
27
- };
28
- const packageDetails = `azsdk-js-ai-text-analytics/5.2.0-beta.2`;
29
- const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
30
- ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
31
- : `${packageDetails}`;
32
- const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
33
- userAgentPrefix
34
- }, baseUri: options.endpoint || "{Endpoint}/text/analytics/{ApiVersion}" });
35
- super(optionsWithDefaults);
36
- // Parameter assignments
37
- this.endpoint = endpoint;
38
- // Assigning values to Constant parameters
39
- this.apiVersion = options.apiVersion || "v3.2-preview.2";
40
- }
41
- }
42
- //# sourceMappingURL=generatedClientContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generatedClientContext.js","sourceRoot":"","sources":["../../../src/generated/generatedClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAGjD,gBAAgB;AAChB,MAAM,OAAO,sBAAuB,SAAQ,UAAU,CAAC,aAAa;IAIlE;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,OAAuC;QACnE,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAAkC;YAC9C,kBAAkB,EAAE,iCAAiC;SACtD,CAAC;QAEF,MAAM,cAAc,GAAG,yCAAyC,CAAC;QACjE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;YAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,cAAc,EAAE;YACjE,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;QAE1B,MAAM,mBAAmB,iDACpB,QAAQ,GACR,OAAO,KACV,gBAAgB,EAAE;gBAChB,eAAe;aAChB,EACD,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,wCAAwC,GACtE,CAAC;QACF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,wBAAwB;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,0CAA0C;QAC1C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,gBAAgB,CAAC;IAC3D,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport { GeneratedClientOptionalParams } from \"./models\";\n\n/** @internal */\nexport class GeneratedClientContext extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the GeneratedClientContext class.\n * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:\n * https://westus.api.cognitive.microsoft.com).\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: GeneratedClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: GeneratedClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-ai-text-analytics/5.2.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri: options.endpoint || \"{Endpoint}/text/analytics/{ApiVersion}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"v3.2-preview.2\";\n }\n}\n"]}
@@ -1,139 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { SpanStatusCode } from "@azure/core-tracing";
4
- import { createSerializer } from "@azure/core-client";
5
- import { makeHealthcareEntitiesErrorResult, makeHealthcareEntitiesResult } from "./analyzeHealthcareEntitiesResult";
6
- import { createSpan } from "./tracing";
7
- import { addStrEncodingParam, getRawResponse, compileError, sendGetRequest } from "./util";
8
- import * as Mappers from "./generated/models/mappers";
9
- import { accept, apiVersion, endpoint, includeStatistics, skip, top } from "./generated/models/parameters";
10
- import { processAndCombineSuccessfulAndErroneousDocuments } from "./textAnalyticsResult";
11
- import { getPagedAsyncIterator } from "@azure/core-paging";
12
- const serializer = createSerializer(Mappers, /* isXml */ false);
13
- // Consider whether the spec can be exported by code gen
14
- const healthStatusOperationSpec = {
15
- path: "/entities/health/jobs/{jobId}",
16
- httpMethod: "GET",
17
- responses: {
18
- 200: {
19
- bodyMapper: Mappers.HealthcareJobState
20
- },
21
- default: {
22
- bodyMapper: Mappers.ErrorResponse
23
- }
24
- },
25
- queryParameters: [includeStatistics, top, skip],
26
- urlParameters: [endpoint, apiVersion],
27
- headerParameters: [accept],
28
- serializer
29
- };
30
- /**
31
- * @internal
32
- */
33
- export class HealthLro {
34
- constructor(
35
- // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
36
- client, baseOptions, initOptions, pollOptions, documents) {
37
- this.client = client;
38
- this.baseOptions = baseOptions;
39
- this.initOptions = initOptions;
40
- this.pollOptions = pollOptions;
41
- this.documents = documents;
42
- this.requestMethod = "POST";
43
- this.requestPath = "/entities/health/jobs";
44
- }
45
- async sendInitialRequest() {
46
- const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-beginAnalyzeHealthcare", Object.assign(Object.assign({}, this.baseOptions), addStrEncodingParam(this.initOptions)));
47
- try {
48
- const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => this.client.health({ documents: this.documents }, paramOptions), finalOptions);
49
- return {
50
- flatResponse: flatResponse,
51
- rawResponse
52
- };
53
- }
54
- catch (e) {
55
- const exception = compileError(e);
56
- span.setStatus({
57
- code: SpanStatusCode.ERROR,
58
- message: exception.message
59
- });
60
- throw exception;
61
- }
62
- finally {
63
- span.end();
64
- }
65
- }
66
- async sendPollRequest(path) {
67
- return sendGetRequest(this.client, healthStatusOperationSpec, "HealthStatus", Object.assign(Object.assign({}, this.baseOptions), this.pollOptions), path);
68
- }
69
- }
70
- /**
71
- * @internal
72
- */
73
- export function isHealthDone(response) {
74
- var _a;
75
- const castResponse = response;
76
- switch (castResponse.status) {
77
- case "notStarted":
78
- case "running":
79
- return false;
80
- case "failed": {
81
- const errors = (_a = castResponse.errors) === null || _a === void 0 ? void 0 : _a.map((e) => ` code ${e.code}, message: '${e.message}'`).join("\n");
82
- const message = `Healthcare analysis failed. Error(s): ${errors || ""}`;
83
- throw new Error(message);
84
- }
85
- default: {
86
- if (castResponse.results) {
87
- return true;
88
- }
89
- else {
90
- throw new Error("Healthcare action has finished but the there are no results!");
91
- }
92
- }
93
- }
94
- }
95
- /**
96
- * @internal
97
- */
98
- export function processHealthResult(
99
- // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
100
- client, documents, options) {
101
- return (result, state) => {
102
- const pollingURL = state.pollingURL;
103
- const pagedResult = {
104
- firstPageLink: pollingURL,
105
- getPage: async (pageLink, maxPageSize) => {
106
- const response = await sendGetRequest(client, healthStatusOperationSpec, "HealthStatus",
107
- // if `top` is set to `undefined`, the default value will not be sent
108
- // as part of the request.
109
- maxPageSize ? Object.assign(Object.assign({}, options), { top: maxPageSize }) : options, pageLink);
110
- const flatResponse = response.flatResponse;
111
- if (flatResponse.results) {
112
- return {
113
- page: processAndCombineSuccessfulAndErroneousDocuments(documents, flatResponse.results, makeHealthcareEntitiesResult, makeHealthcareEntitiesErrorResult),
114
- nextPageLink: flatResponse.nextLink
115
- };
116
- }
117
- else {
118
- throw new Error("Healthcare action has succeeded but there are no results!");
119
- }
120
- }
121
- };
122
- const pagedIterator = getPagedAsyncIterator(pagedResult);
123
- return Object.assign(pagedIterator, {
124
- statistics: result.results.statistics,
125
- modelVersion: result.results.modelVersion
126
- });
127
- };
128
- }
129
- /**
130
- * @internal
131
- */
132
- export function updateHealthState(state, lastResponse) {
133
- const response = lastResponse.body;
134
- state.createdOn = response.createdDateTime;
135
- state.lastModifiedOn = response.lastUpdateDateTime;
136
- state.expiresOn = response.expirationDateTime;
137
- state.status = response.status;
138
- }
139
- //# sourceMappingURL=healthLro.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"healthLro.js","sourceRoot":"","sources":["../../src/healthLro.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAmC,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAGL,iCAAiC,EACjC,4BAA4B,EAE7B,MAAM,mCAAmC,CAAC;AAO3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,cAAc,EAEf,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACL,MAAM,EACN,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,GAAG,EACJ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gDAAgD,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAe,MAAM,oBAAoB,CAAC;AAoCxE,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAEhE,wDAAwD;AACxD,MAAM,yBAAyB,GAAkB;IAC/C,IAAI,EAAE,+BAA+B;IACrC,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,kBAAkB;SACvC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,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) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { LongRunningOperation, LroResponse, PollerLike, RawResponse } from \"@azure/core-lro\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { createSerializer, OperationOptions, OperationSpec } from \"@azure/core-client\";\nimport {\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray,\n makeHealthcareEntitiesErrorResult,\n makeHealthcareEntitiesResult,\n PagedAnalyzeHealthcareEntitiesResult\n} from \"./analyzeHealthcareEntitiesResult\";\nimport {\n GeneratedClient,\n GeneratedClientHealthStatusOptionalParams,\n GeneratedClientHealthStatusResponse,\n TextDocumentInput\n} from \"./generated\";\nimport { createSpan } from \"./tracing\";\nimport {\n addStrEncodingParam,\n getRawResponse,\n compileError,\n sendGetRequest,\n StringIndexType\n} from \"./util\";\nimport * as Mappers from \"./generated/models/mappers\";\nimport {\n accept,\n apiVersion,\n endpoint,\n includeStatistics,\n skip,\n top\n} from \"./generated/models/parameters\";\nimport { processAndCombineSuccessfulAndErroneousDocuments } from \"./textAnalyticsResult\";\nimport { getPagedAsyncIterator, PagedResult } from \"@azure/core-paging\";\nimport { AnalysisPollOperationState } from \"./pollerModels\";\nimport { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions\";\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 * Result type of the Health Long-Running-Operation (LRO)\n */\nexport type AnalyzeHealthcareEntitiesPollerLike = PollerLike<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n>;\n\n/**\n * The state of the begin analyze healthcare polling operation.\n */\nexport interface AnalyzeHealthcareOperationState\n extends AnalysisPollOperationState<PagedAnalyzeHealthcareEntitiesResult> {}\n\nconst serializer = createSerializer(Mappers, /* isXml */ false);\n\n// Consider whether the spec can be exported by code gen\nconst healthStatusOperationSpec: OperationSpec = {\n path: \"/entities/health/jobs/{jobId}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.HealthcareJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [includeStatistics, top, skip],\n urlParameters: [endpoint, apiVersion],\n headerParameters: [accept],\n serializer\n};\n\n/**\n * @internal\n */\nexport class HealthLro implements LongRunningOperation<PagedAnalyzeHealthcareEntitiesResult> {\n public requestMethod = \"POST\";\n public requestPath = \"/entities/health/jobs\";\n constructor(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: GeneratedClient,\n private baseOptions: OperationOptions,\n private initOptions: {\n modelVersion?: string;\n stringIndexType?: StringIndexType;\n loggingOptOut?: boolean;\n },\n private pollOptions: {\n includeStatistics?: boolean;\n },\n private documents: TextDocumentInput[]\n ) {}\n async sendInitialRequest(): Promise<LroResponse<PagedAnalyzeHealthcareEntitiesResult>> {\n const { span, updatedOptions: finalOptions } = createSpan(\n \"TextAnalyticsClient-beginAnalyzeHealthcare\",\n {\n ...this.baseOptions,\n ...addStrEncodingParam(this.initOptions)\n }\n );\n try {\n const { flatResponse, rawResponse } = await getRawResponse(\n (paramOptions) => this.client.health({ documents: this.documents }, paramOptions),\n finalOptions\n );\n return {\n flatResponse: flatResponse as PagedAnalyzeHealthcareEntitiesResult,\n rawResponse\n };\n } catch (e) {\n const exception = compileError(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: exception.message\n });\n throw exception;\n } finally {\n span.end();\n }\n }\n async sendPollRequest(path: string): Promise<LroResponse<PagedAnalyzeHealthcareEntitiesResult>> {\n return sendGetRequest(\n this.client,\n healthStatusOperationSpec,\n \"HealthStatus\",\n { ...this.baseOptions, ...this.pollOptions },\n path\n ) as Promise<LroResponse<PagedAnalyzeHealthcareEntitiesResult>>;\n }\n}\n\n/**\n * @internal\n */\nexport function isHealthDone(response: unknown): boolean {\n const castResponse = response as GeneratedClientHealthStatusResponse;\n switch (castResponse.status) {\n case \"notStarted\":\n case \"running\":\n return false;\n case \"failed\": {\n const errors = castResponse.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 (castResponse.results) {\n return true;\n } else {\n throw new Error(\"Healthcare action has finished but the there are no results!\");\n }\n }\n }\n}\n\n/**\n * @internal\n */\nexport function processHealthResult(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n client: GeneratedClient,\n documents: TextDocumentInput[],\n options: GeneratedClientHealthStatusOptionalParams\n): (\n result: unknown,\n state: AnalyzeHealthcareOperationState\n) => PagedAnalyzeHealthcareEntitiesResult {\n return (\n result: unknown,\n state: AnalyzeHealthcareOperationState\n ): PagedAnalyzeHealthcareEntitiesResult => {\n const pollingURL = (state as any).pollingURL;\n const pagedResult: PagedResult<AnalyzeHealthcareEntitiesResultArray> = {\n firstPageLink: pollingURL,\n getPage: async (pageLink: string, maxPageSize?: number) => {\n const response = await sendGetRequest(\n client,\n healthStatusOperationSpec,\n \"HealthStatus\",\n // if `top` is set to `undefined`, the default value will not be sent\n // as part of the request.\n maxPageSize ? { ...options, top: maxPageSize } : options,\n pageLink\n );\n const flatResponse = response.flatResponse as GeneratedClientHealthStatusResponse;\n if (flatResponse.results) {\n return {\n page: processAndCombineSuccessfulAndErroneousDocuments(\n documents,\n flatResponse.results,\n makeHealthcareEntitiesResult,\n makeHealthcareEntitiesErrorResult\n ),\n nextPageLink: flatResponse.nextLink\n };\n } else {\n throw new Error(\"Healthcare action has succeeded but there are no results!\");\n }\n }\n };\n const pagedIterator = getPagedAsyncIterator<\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray\n >(pagedResult);\n return Object.assign(pagedIterator, {\n statistics: (result as any).results.statistics,\n modelVersion: (result as any).results.modelVersion!\n });\n };\n}\n\n/**\n * @internal\n */\nexport function updateHealthState(\n state: AnalyzeHealthcareOperationState,\n lastResponse: RawResponse\n): void {\n const response = lastResponse.body as any;\n state.createdOn = response.createdDateTime;\n state.lastModifiedOn = response.lastUpdateDateTime;\n state.expiresOn = response.expirationDateTime;\n state.status = response.status;\n}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeMultiCategoryClassifyResult(result) {
8
- const { id, warnings, statistics, classifications } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { classifications });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeMultiCategoryClassifyErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=multiCategoryClassifyResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multiCategoryClassifyResult.js","sourceRoot":"","sources":["../../src/multiCategoryClassifyResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AA2B/B;;GAEG;AACH,MAAM,UAAU,+BAA+B,CAC7C,MAAmC;IAEnC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAC7D,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,eAAe,IACf;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAClD,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport { TextAnalyticsError, MultiClassificationDocument } from \"./generated/models\";\nimport { ClassificationCategory } from \"./singleCategoryClassifyResult\";\n\n/**\n * The result of the custom classify document multi categories operation on a multi document.\n */\nexport type MultiCategoryClassifyResult =\n | MultiCategoryClassifySuccessResult\n | MultiCategoryClassifyErrorResult;\n\n/**\n * The result of the custom classify document multi categories operation on a multi document,\n * containing the result of the classification.\n */\nexport interface MultiCategoryClassifySuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of classifications in the input document.\n */\n classifications: ClassificationCategory[];\n}\n\n/**\n * An error result from the custom classify document multi category operation on a multi document.\n */\nexport type MultiCategoryClassifyErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeMultiCategoryClassifyResult(\n result: MultiClassificationDocument\n): MultiCategoryClassifySuccessResult {\n const { id, warnings, statistics, classifications } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n classifications\n };\n}\n\n/**\n * @internal\n */\nexport function makeMultiCategoryClassifyErrorResult(\n id: string,\n error: TextAnalyticsError\n): MultiCategoryClassifyErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeMultiCategoryClassifyResult, makeMultiCategoryClassifyErrorResult } from "./multiCategoryClassifyResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeMultiCategoryClassifyResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo(input, response, makeMultiCategoryClassifyResult, makeMultiCategoryClassifyErrorResult);
10
- }
11
- //# sourceMappingURL=multiCategoryClassifyResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multiCategoryClassifyResultArray.js","sourceRoot":"","sources":["../../src/multiCategoryClassifyResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,+BAA+B,EAC/B,oCAAoC,EACrC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,wEAAwE,EAAE,MAAM,uBAAuB,CAAC;AAyBjH;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAClD,KAA0B,EAC1B,QAAyC;IAEzC,OAAO,wEAAwE,CAC7E,KAAK,EACL,QAAQ,EACR,+BAA+B,EAC/B,oCAAoC,CACrC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentBatchStatistics,\n TextDocumentInput,\n CustomMultiClassificationResult\n} from \"./generated/models\";\nimport {\n MultiCategoryClassifyResult,\n makeMultiCategoryClassifyResult,\n makeMultiCategoryClassifyErrorResult\n} from \"./multiCategoryClassifyResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo } from \"./textAnalyticsResult\";\n\n/**\n * Array of `MultiCategoryClassifyResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface MultiCategoryClassifyResultArray extends Array<MultiCategoryClassifyResult> {\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 custom project used by this operation on this\n * batch of input documents.\n */\n projectName: string;\n /**\n * The version of the text analytics custom deployment used by this operation on this\n * batch of input documents.\n */\n deploymentName: string;\n}\n\n/**\n * @internal\n */\nexport function makeMultiCategoryClassifyResultArray(\n input: TextDocumentInput[],\n response: CustomMultiClassificationResult\n): MultiCategoryClassifyResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo(\n input,\n response,\n makeMultiCategoryClassifyResult,\n makeMultiCategoryClassifyErrorResult\n );\n}\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=pollerModels.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pollerModels.js","sourceRoot":"","sources":["../../src/pollerModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PollOperationState } from \"@azure/core-lro\";\nimport { State } from \"./generated/models\";\n\n/**\n * Metadata information for an analysis poller operation.\n */\nexport interface OperationMetadata {\n /**\n * The date and time the operation was created.\n */\n createdOn: Date;\n /**\n * The date and time when the operation results will expire on the server.\n */\n expiresOn?: Date;\n /**\n * The operation id.\n */\n operationId: string;\n /**\n * The time the operation status was last updated.\n */\n lastModifiedOn: Date;\n /**\n * The current status of the operation.\n */\n status: State;\n}\n\n/**\n * An interface representing the state of an analysis poller operation.\n */\nexport interface AnalysisPollOperationState<TResult>\n extends PollOperationState<TResult>,\n OperationMetadata {}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeRecognizeCategorizedEntitiesResult(result) {
8
- const { entities, statistics, warnings, id } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { entities });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeRecognizeCategorizedEntitiesErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=recognizeCategorizedEntitiesResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recognizeCategorizedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAgC/B;;GAEG;AACH,MAAM,UAAU,sCAAsC,CACpD,MAAwB;IAExB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IACtD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ,IACR;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2CAA2C,CACzD,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport { Entity, TextAnalyticsError, DocumentEntities } from \"./generated/models\";\n\n/**\n * An entity from text analysis with information about its categorical\n * classification.\n */\nexport interface CategorizedEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesResult =\n | RecognizeCategorizedEntitiesSuccessResult\n | RecognizeCategorizedEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizeCategorizedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: CategorizedEntity[];\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesResult(\n result: DocumentEntities\n): RecognizeCategorizedEntitiesSuccessResult {\n const { entities, statistics, warnings, id } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError\n): RecognizeCategorizedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeRecognizeCategorizedEntitiesResult, makeRecognizeCategorizedEntitiesErrorResult } from "./recognizeCategorizedEntitiesResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeRecognizeCategorizedEntitiesResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeRecognizeCategorizedEntitiesResult, makeRecognizeCategorizedEntitiesErrorResult);
10
- }
11
- //# sourceMappingURL=recognizeCategorizedEntitiesResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recognizeCategorizedEntitiesResultArray.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,sCAAsC,EACtC,2CAA2C,EAC5C,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAqB5G;;GAEG;AACH,MAAM,UAAU,2CAA2C,CACzD,KAA0B,EAC1B,QAAwB;IAExB,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,sCAAsC,EACtC,2CAA2C,CAC5C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TextDocumentBatchStatistics, TextDocumentInput, EntitiesResult } from \"./generated/models\";\nimport {\n RecognizeCategorizedEntitiesResult,\n makeRecognizeCategorizedEntitiesResult,\n makeRecognizeCategorizedEntitiesErrorResult\n} from \"./recognizeCategorizedEntitiesResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `RecognizeCategorizedEntitiesResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface RecognizeCategorizedEntitiesResultArray\n extends Array<RecognizeCategorizedEntitiesResult> {\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesResultArray(\n input: TextDocumentInput[],\n response: EntitiesResult\n): RecognizeCategorizedEntitiesResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeRecognizeCategorizedEntitiesResult,\n makeRecognizeCategorizedEntitiesErrorResult\n );\n}\n"]}