@azure/ai-language-text 1.0.0-alpha.20220816.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -53
- package/dist/index.js +198 -455
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/generated/generatedClient.js +2 -2
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +71 -47
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +16 -281
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +1 -1
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/index.js +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/lro.js +19 -24
- package/dist-esm/src/lro.js.map +1 -1
- package/dist-esm/src/models.js +0 -9
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/textAnalysisClient.js +41 -26
- package/dist-esm/src/textAnalysisClient.js.map +1 -1
- package/dist-esm/src/transforms.js +38 -43
- package/dist-esm/src/transforms.js.map +1 -1
- package/dist-esm/src/util.js +7 -8
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +7 -7
- package/types/ai-language-text.d.ts +63 -148
package/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[Azure Cognitive Service for Language](https://azure.microsoft.com/services/cognitive-services/language-service/) is a cloud-based service that provides advanced natural language processing over raw text, and includes the following main features:
|
4
4
|
|
5
|
-
**Note:** This SDK targets Azure Cognitive Service for Language API version 2022-
|
5
|
+
**Note:** This SDK targets Azure Cognitive Service for Language API version 2022-05-01.
|
6
6
|
|
7
7
|
- Language Detection
|
8
8
|
- Sentiment Analysis
|
@@ -11,7 +11,6 @@
|
|
11
11
|
- Recognition of Personally Identifiable Information
|
12
12
|
- Entity Linking
|
13
13
|
- Healthcare Analysis
|
14
|
-
- Extractive Summarization
|
15
14
|
- Custom Entity Recognition
|
16
15
|
- Custom Document Classification
|
17
16
|
- Support Multiple Actions Per Document
|
@@ -446,56 +445,6 @@ async function main() {
|
|
446
445
|
main();
|
447
446
|
```
|
448
447
|
|
449
|
-
### Extractive Summarization
|
450
|
-
|
451
|
-
Extractive summarization identifies sentences that summarize the article they belong to.
|
452
|
-
|
453
|
-
```javascript
|
454
|
-
const {
|
455
|
-
AzureKeyCredential,
|
456
|
-
TextAnalysisClient,
|
457
|
-
} = require("@azure/ai-language-text");
|
458
|
-
|
459
|
-
const client = new TextAnalysisClient("<endpoint>", new AzureKeyCredential("<API key>"));
|
460
|
-
|
461
|
-
const documents = [
|
462
|
-
"Prescribed 100mg ibuprofen, taken twice daily.",
|
463
|
-
"Patient does not suffer from high blood pressure.",
|
464
|
-
];
|
465
|
-
|
466
|
-
async function main() {
|
467
|
-
const actions = [
|
468
|
-
{
|
469
|
-
kind: "ExtractiveSummarization",
|
470
|
-
maxSentenceCount: 2,
|
471
|
-
},
|
472
|
-
];
|
473
|
-
const poller = await client.beginAnalyzeBatch(actions, documents, "en");
|
474
|
-
const results = await poller.pollUntilDone();
|
475
|
-
|
476
|
-
for await (const actionResult of results) {
|
477
|
-
if (actionResult.kind !== "ExtractiveSummarization") {
|
478
|
-
throw new Error(`Expected extractive summarization results but got: ${actionResult.kind}`);
|
479
|
-
}
|
480
|
-
if (actionResult.error) {
|
481
|
-
const { code, message } = actionResult.error;
|
482
|
-
throw new Error(`Unexpected error (${code}): ${message}`);
|
483
|
-
}
|
484
|
-
for (const result of actionResult.results) {
|
485
|
-
console.log(`- Document ${result.id}`);
|
486
|
-
if (result.error) {
|
487
|
-
const { code, message } = result.error;
|
488
|
-
throw new Error(`Unexpected error (${code}): ${message}`);
|
489
|
-
}
|
490
|
-
console.log("Summary:");
|
491
|
-
console.log(result.sentences.map((sentence) => sentence.text).join("\n"));
|
492
|
-
}
|
493
|
-
}
|
494
|
-
}
|
495
|
-
|
496
|
-
main();
|
497
|
-
```
|
498
|
-
|
499
448
|
### Custom Entity Recognition
|
500
449
|
|
501
450
|
Recognize and categorize entities in text as entities using custom entity detection models built using [Azure Language Studio][lang_studio].
|
@@ -587,7 +536,7 @@ async function main() {
|
|
587
536
|
const { code, message } = result.error;
|
588
537
|
throw new Error(`Unexpected error (${code}): ${message}`);
|
589
538
|
}
|
590
|
-
console.log(`\tClassification: ${result.
|
539
|
+
console.log(`\tClassification: ${result.classifications[0].category}`);
|
591
540
|
}
|
592
541
|
}
|
593
542
|
}
|