Skip to content

Commit 8c77abb

Browse files
authored
[Language-text] Update package version (Azure#25152)
1 parent dab234b commit 8c77abb

File tree

19 files changed

+398
-16
lines changed

19 files changed

+398
-16
lines changed

sdk/cognitivelanguage/ai-language-text/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Release History
22

3+
## 1.1.0-beta.3 (Unreleased)
4+
5+
### Features Added
6+
7+
### Breaking Changes
8+
9+
### Bugs Fixed
10+
11+
### Other Changes
12+
313
## 1.1.0-beta.2 (2023-03-07)
414

515
### Features Added

sdk/cognitivelanguage/ai-language-text/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"sdk-type": "client",
44
"author": "Microsoft Corporation",
55
"description": "An isomorphic client library for the text analysis features in the Azure Cognitive Language Service.",
6-
"version": "1.1.0-beta.2",
6+
"version": "1.1.0-beta.3",
77
"keywords": [
88
"node",
99
"azure",

sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ These sample programs show how to use the JavaScript client libraries for Azure
1818
| [dynamicClassification.js][dynamicclassification] | assigns either one or multiple categories per document. |
1919
| [entityLinking.js][entitylinking] | detects entities that have links to more information on the web |
2020
| [entityRecognition.js][entityrecognition] | detects entities in a piece of text |
21+
| [entityResolutions.js][entityresolutions] | detects entities in a piece of text |
2122
| [keyPhraseExtraction.js][keyphraseextraction] | extracts key phrases from a piece of text |
2223
| [languageDetection.js][languagedetection] | detects the language of a piece of text |
2324
| [piiEntityRecognition.js][piientityrecognition] | detects personally-identifiable information |
2425
| [sentimentAnalysis.js][sentimentanalysis] | analyzes the sentiment of a piece of text |
2526
| [stats.js][stats] | access statistics about documents and transactions |
2627
| [abstractiveSummarization.js][abstractivesummarization] | generates a summary for an article |
28+
| [autoLanguageDetection.js][autolanguagedetection] | return detected language with the task |
2729
| [customEntityRecognition.js][customentityrecognition] | detects custom text in a piece of text |
2830
| [customMultiLabelClassification.js][custommultilabelclassification] | multi-label classification of pieces of text |
2931
| [customSingleLabelClassification.js][customsinglelabelclassification] | single-label classification of pieces of text |
@@ -79,12 +81,14 @@ Take a look at our [API Documentation][apiref] for more information about the AP
7981
[dynamicclassification]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/dynamicClassification.js
8082
[entitylinking]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/entityLinking.js
8183
[entityrecognition]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/entityRecognition.js
84+
[entityresolutions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/entityResolutions.js
8285
[keyphraseextraction]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/keyPhraseExtraction.js
8386
[languagedetection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/languageDetection.js
8487
[piientityrecognition]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/piiEntityRecognition.js
8588
[sentimentanalysis]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/sentimentAnalysis.js
8689
[stats]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/stats.js
8790
[abstractivesummarization]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/abstractiveSummarization.js
91+
[autolanguagedetection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/autoLanguageDetection.js
8892
[customentityrecognition]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/customEntityRecognition.js
8993
[custommultilabelclassification]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/customMultiLabelClassification.js
9094
[customsinglelabelclassification]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/customSingleLabelClassification.js

sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/abstractiveSummarization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function main() {
4040
const actions = [
4141
{
4242
kind: "AbstractiveSummarization",
43-
maxSentenceCount: 2,
43+
sentenceCount: 2,
4444
},
4545
];
4646
const poller = await client.beginAnalyzeBatch(actions, documents, "en");
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
/**
5+
* In this sample, we use the complementary automatic language detection
6+
* with an abstractive summarization task to receive the detected
7+
* language of the input document.
8+
*
9+
* The abstractive summarization feature is part of a gated preview. Access can
10+
* be request in {@link https://aka.ms/applyforgatedsummarizationfeatures}.
11+
*
12+
* @summary return detected language with the task
13+
*/
14+
15+
const { TextAnalysisClient, AzureKeyCredential } = require("@azure/ai-language-text");
16+
17+
// Load the .env file if it exists
18+
require("dotenv").config();
19+
20+
// You will need to set these environment variables or edit the following values
21+
const endpoint = process.env["ENDPOINT"] || "<cognitive language service endpoint>";
22+
const apiKey = process.env["LANGUAGE_API_KEY"] || "<api key>";
23+
24+
const documents = [
25+
"Microsoft was founded by Bill Gates and Paul Allen.",
26+
"Mon amie vit à Seattle",
27+
"Ich besuchte Deutsch während Weihnachten",
28+
];
29+
30+
async function main() {
31+
console.log("== Automatic Language Detection Sample ==");
32+
33+
const client = new TextAnalysisClient(endpoint, new AzureKeyCredential(apiKey));
34+
35+
const actions = [
36+
{
37+
kind: "EntityRecognition",
38+
},
39+
];
40+
const poller = await client.beginAnalyzeBatch(actions, documents, "auto");
41+
42+
poller.onProgress(() => {
43+
console.log(
44+
`Last time the operation was updated was on: ${poller.getOperationState().modifiedOn}`
45+
);
46+
});
47+
console.log(`The operation was created on ${poller.getOperationState().createdOn}`);
48+
console.log(`The operation results will expire on ${poller.getOperationState().expiresOn}`);
49+
50+
const results = await poller.pollUntilDone();
51+
for await (const actionResult of results) {
52+
if (actionResult.kind !== "EntityRecognition") {
53+
throw new Error(`Expected entity recognition results but got: ${actionResult.kind}`);
54+
}
55+
56+
if (actionResult.error) {
57+
const { code, message } = actionResult.error;
58+
throw new Error(`Unexpected error (${code}): ${message}`);
59+
}
60+
61+
for (const result of actionResult.results) {
62+
console.log(`- Document ${result.id}`);
63+
if (result.error) {
64+
const { code, message } = result.error;
65+
throw new Error(`Unexpected error (${code}): ${message}`);
66+
}
67+
68+
if (result.detectedLanguage) {
69+
const { name, iso6391Name, confidenceScore } = result.detectedLanguage;
70+
console.log(
71+
"Document language identified as",
72+
name,
73+
"( ISO6391:",
74+
iso6391Name,
75+
", Score:",
76+
confidenceScore,
77+
")"
78+
);
79+
}
80+
81+
console.log("\tRecognized Entities:");
82+
for (const entity of result.entities) {
83+
console.log(`\t- Entity ${entity.text} of type ${entity.category}`);
84+
}
85+
}
86+
}
87+
}
88+
89+
main().catch((err) => {
90+
console.error("The sample encountered an error:", err);
91+
});
92+
93+
module.exports = { main };
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
/**
5+
* Uses the entity recognition endpoint to detect entities in a document using
6+
* Named Entity Recognition (NER) and prints them along with their recognized
7+
* entity type and resolution.
8+
*
9+
* @summary detects entities in a piece of text
10+
*/
11+
12+
const { TextAnalysisClient, AzureKeyCredential } = require("@azure/ai-language-text");
13+
14+
// Load the .env file if it exists
15+
require("dotenv").config();
16+
17+
// You will need to set these environment variables or edit the following values
18+
const endpoint = process.env["ENDPOINT"] || "<cognitive language service endpoint>";
19+
const apiKey = process.env["LANGUAGE_API_KEY"] || "<api key>";
20+
21+
const documents = [
22+
"Microsoft was founded by Bill Gates and Paul Allen.",
23+
"I had a wonderful trip to Seattle last week.",
24+
"I visited the Space Needle 2 times.",
25+
];
26+
27+
async function main() {
28+
console.log("== Recognize Entities Sample ==");
29+
30+
const client = new TextAnalysisClient(endpoint, new AzureKeyCredential(apiKey));
31+
32+
const actions = [
33+
{
34+
kind: "EntityRecognition",
35+
modelVersion: "2022-10-01-preview",
36+
},
37+
];
38+
const poller = await client.beginAnalyzeBatch(actions, documents, "en");
39+
const results = await poller.pollUntilDone();
40+
for await (const actionResult of results) {
41+
if (actionResult.kind !== "EntityRecognition") {
42+
throw new Error(`Expected abstractive summarization results but got: ${actionResult.kind}`);
43+
}
44+
45+
if (actionResult.error) {
46+
const { code, message } = actionResult.error;
47+
throw new Error(`Unexpected error (${code}): ${message}`);
48+
}
49+
50+
for (const result of actionResult.results) {
51+
console.log(`- Document ${result.id}`);
52+
if (result.error) {
53+
const { code, message } = result.error;
54+
throw new Error(`Unexpected error (${code}): ${message}`);
55+
}
56+
57+
console.log("\tRecognized Entities:");
58+
for (const entity of result.entities) {
59+
console.log(`\t- Entity ${entity.text} of type ${entity.category}`);
60+
61+
if (entity.resolutions) {
62+
console.log("\tRecognized Resolution:");
63+
for (const resolution of entity.resolutions) {
64+
const { resolutionKind, ...resolutionInfo } = resolution;
65+
console.log(`\t- Resolution of type ${resolutionKind}`);
66+
console.log(`\t- Resolution information ${JSON.stringify(resolutionInfo)}`);
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
73+
74+
main().catch((err) => {
75+
console.error("The sample encountered an error:", err);
76+
});
77+
78+
module.exports = { main };

sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/healthcare.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ async function main() {
8686
console.log(`\t\t\t- "${role.entity.text}" with the role ${role.name}`);
8787
}
8888
}
89-
if (result.fhirBundle) {
90-
console.log(`FHIR object: ${JSON.stringify(result.fhirBundle, undefined, 2)}`);
91-
}
89+
}
90+
91+
if (result.fhirBundle) {
92+
console.log(`FHIR object: ${JSON.stringify(result.fhirBundle, undefined, 2)}`);
9293
}
9394
}
9495
}

sdk/cognitivelanguage/ai-language-text/samples/v1-beta/javascript/languageDetection.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* endpoint provides a primary language as well as a score representing the
88
* service's confidence in the correctness of its assessment.
99
*
10+
* Script detection feature can be enabled with the "2022-04-10-preview" model version.
11+
*
1012
* @summary detects the language of a piece of text
1113
*/
1214

@@ -32,13 +34,18 @@ async function main() {
3234

3335
const client = new TextAnalysisClient(endpoint, new AzureKeyCredential(apiKey));
3436

35-
const result = await client.analyze("LanguageDetection", documents, "us");
37+
const result = await client.analyze("LanguageDetection", documents, "us", {
38+
modelVersion: "2022-04-10-preview",
39+
});
3640

3741
for (const doc of result) {
3842
if (!doc.error) {
3943
console.log(
4044
`Primary language: ${doc.primaryLanguage.name} (iso6391 name: ${doc.primaryLanguage.iso6391Name})`
4145
);
46+
if (doc.primaryLanguage.script) {
47+
console.log(`Detected script: ${doc.primaryLanguage.script}`);
48+
}
4249
}
4350
}
4451
}

sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ These sample programs show how to use the TypeScript client libraries for Azure
1818
| [dynamicClassification.ts][dynamicclassification] | assigns either one or multiple categories per document. |
1919
| [entityLinking.ts][entitylinking] | detects entities that have links to more information on the web |
2020
| [entityRecognition.ts][entityrecognition] | detects entities in a piece of text |
21+
| [entityResolutions.ts][entityresolutions] | detects entities in a piece of text |
2122
| [keyPhraseExtraction.ts][keyphraseextraction] | extracts key phrases from a piece of text |
2223
| [languageDetection.ts][languagedetection] | detects the language of a piece of text |
2324
| [piiEntityRecognition.ts][piientityrecognition] | detects personally-identifiable information |
2425
| [sentimentAnalysis.ts][sentimentanalysis] | analyzes the sentiment of a piece of text |
2526
| [stats.ts][stats] | access statistics about documents and transactions |
2627
| [abstractiveSummarization.ts][abstractivesummarization] | generates a summary for an article |
28+
| [autoLanguageDetection.ts][autolanguagedetection] | return detected language with the task |
2729
| [customEntityRecognition.ts][customentityrecognition] | detects custom text in a piece of text |
2830
| [customMultiLabelClassification.ts][custommultilabelclassification] | multi-label classification of pieces of text |
2931
| [customSingleLabelClassification.ts][customsinglelabelclassification] | single-label classification of pieces of text |
@@ -91,12 +93,14 @@ Take a look at our [API Documentation][apiref] for more information about the AP
9193
[dynamicclassification]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/dynamicClassification.ts
9294
[entitylinking]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/entityLinking.ts
9395
[entityrecognition]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/entityRecognition.ts
96+
[entityresolutions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/entityResolutions.ts
9497
[keyphraseextraction]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/keyPhraseExtraction.ts
9598
[languagedetection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/languageDetection.ts
9699
[piientityrecognition]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/piiEntityRecognition.ts
97100
[sentimentanalysis]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/sentimentAnalysis.ts
98101
[stats]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/stats.ts
99102
[abstractivesummarization]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/abstractiveSummarization.ts
103+
[autolanguagedetection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/autoLanguageDetection.ts
100104
[customentityrecognition]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/customEntityRecognition.ts
101105
[custommultilabelclassification]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/customMultiLabelClassification.ts
102106
[customsinglelabelclassification]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/customSingleLabelClassification.ts

sdk/cognitivelanguage/ai-language-text/samples/v1-beta/typescript/src/abstractiveSummarization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function main() {
4545
const actions: AnalyzeBatchAction[] = [
4646
{
4747
kind: "AbstractiveSummarization",
48-
maxSentenceCount: 2,
48+
sentenceCount: 2,
4949
},
5050
];
5151
const poller = await client.beginAnalyzeBatch(actions, documents, "en");

0 commit comments

Comments
 (0)