@azure/ai-text-analytics 5.1.1-alpha.20250225.1 → 5.1.1-alpha.20250226.2
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 +191 -195
- package/dist/browser/textAnalyticsClient.d.ts +2 -5
- package/dist/browser/textAnalyticsClient.d.ts.map +1 -1
- package/dist/browser/textAnalyticsClient.js +2 -5
- package/dist/browser/textAnalyticsClient.js.map +1 -1
- package/dist/commonjs/textAnalyticsClient.d.ts +2 -5
- package/dist/commonjs/textAnalyticsClient.d.ts.map +1 -1
- package/dist/commonjs/textAnalyticsClient.js +2 -5
- package/dist/commonjs/textAnalyticsClient.js.map +1 -1
- package/dist/esm/textAnalyticsClient.d.ts +2 -5
- package/dist/esm/textAnalyticsClient.d.ts.map +1 -1
- package/dist/esm/textAnalyticsClient.js +2 -5
- package/dist/esm/textAnalyticsClient.js.map +1 -1
- package/dist/react-native/textAnalyticsClient.d.ts +2 -5
- package/dist/react-native/textAnalyticsClient.d.ts.map +1 -1
- package/dist/react-native/textAnalyticsClient.js +2 -5
- package/dist/react-native/textAnalyticsClient.js.map +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -79,8 +79,8 @@ az cognitiveservices account keys list --resource-group <your-resource-group-nam
|
|
|
79
79
|
|
|
80
80
|
Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows:
|
|
81
81
|
|
|
82
|
-
```
|
|
83
|
-
|
|
82
|
+
```ts snippet:ReadmeSampleCreateClient_KeyCredential
|
|
83
|
+
import { TextAnalyticsClient, AzureKeyCredential } from "@azure/ai-text-analytics";
|
|
84
84
|
|
|
85
85
|
const client = new TextAnalyticsClient("<endpoint>", new AzureKeyCredential("<API key>"));
|
|
86
86
|
```
|
|
@@ -98,9 +98,9 @@ You will also need to [register a new AAD application][register_aad_app] and gra
|
|
|
98
98
|
|
|
99
99
|
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
|
|
100
100
|
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
```ts snippet:ReadmeSampleCreateClient_AADCredential
|
|
102
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
103
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
104
104
|
|
|
105
105
|
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
106
106
|
```
|
|
@@ -117,7 +117,7 @@ A **document** represents a single unit of input to be analyzed by the predictiv
|
|
|
117
117
|
|
|
118
118
|
For example, each document can be passed as a string in an array, e.g.
|
|
119
119
|
|
|
120
|
-
```
|
|
120
|
+
```ts snippet:ReadmeSampleInput
|
|
121
121
|
const documents = [
|
|
122
122
|
"I hated the movie. It was so slow!",
|
|
123
123
|
"The movie made it into my top ten favorites.",
|
|
@@ -127,7 +127,7 @@ const documents = [
|
|
|
127
127
|
|
|
128
128
|
or, if you wish to pass in a per-item document `id` or `language`/`countryHint`, they can be given as a list of `TextDocumentInput` or `DetectLanguageInput` depending on the operation;
|
|
129
129
|
|
|
130
|
-
```
|
|
130
|
+
```ts snippet:ReadmeSampleInputWithMetadata
|
|
131
131
|
const textDocumentInputs = [
|
|
132
132
|
{ id: "1", language: "en", text: "I hated the movie. It was so slow!" },
|
|
133
133
|
{ id: "2", language: "en", text: "The movie made it into my top ten favorites." },
|
|
@@ -151,17 +151,32 @@ In the collection returned by an operation, errors are distinguished from succes
|
|
|
151
151
|
|
|
152
152
|
For example, to filter out all errors, you could use the following `filter`:
|
|
153
153
|
|
|
154
|
-
```
|
|
154
|
+
```ts snippet:ReadmeSampleFilterErrors
|
|
155
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
156
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
157
|
+
|
|
158
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
159
|
+
|
|
160
|
+
const documents = [
|
|
161
|
+
"I hated the movie. It was so slow!",
|
|
162
|
+
"The movie made it into my top ten favorites.",
|
|
163
|
+
"What a great movie!",
|
|
164
|
+
];
|
|
165
|
+
|
|
155
166
|
const results = await client.analyzeSentiment(documents);
|
|
156
|
-
const onlySuccessful = results.filter((result) => result.error
|
|
167
|
+
const onlySuccessful = results.filter((result) => !result.error);
|
|
157
168
|
```
|
|
158
169
|
|
|
159
170
|
**Note**: TypeScript users can benefit from better type-checking of result and error objects if `compilerOptions.strictNullChecks` is set to `true` in the `tsconfig.json` configuration. For example:
|
|
160
171
|
|
|
161
|
-
```
|
|
162
|
-
|
|
172
|
+
```ts snippet:ReadmeSampleTypeScriptStrictNullChecks
|
|
173
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
174
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
175
|
+
|
|
176
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
163
177
|
|
|
164
|
-
|
|
178
|
+
const [result] = await client.analyzeSentiment(["Hello world!"]);
|
|
179
|
+
if (result.error) {
|
|
165
180
|
// In this if block, TypeScript will be sure that the type of `result` is
|
|
166
181
|
// `TextAnalyticsError` if compilerOptions.strictNullChecks is enabled in
|
|
167
182
|
// the tsconfig.json
|
|
@@ -172,11 +187,16 @@ if (result.error !== undefined) {
|
|
|
172
187
|
|
|
173
188
|
This capability was introduced in TypeScript 3.2, so users of TypeScript 3.1 must cast result values to their corresponding success variant as follows:
|
|
174
189
|
|
|
175
|
-
```
|
|
190
|
+
```ts snippet:ReadmeSampleTypeScriptCast
|
|
191
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
192
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
193
|
+
|
|
194
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
195
|
+
|
|
176
196
|
const [result] = await client.detectLanguage(["Hello world!"]);
|
|
177
197
|
|
|
178
198
|
if (result.error === undefined) {
|
|
179
|
-
const { primaryLanguage } = result
|
|
199
|
+
const { primaryLanguage } = result;
|
|
180
200
|
}
|
|
181
201
|
```
|
|
182
202
|
|
|
@@ -186,31 +206,30 @@ if (result.error === undefined) {
|
|
|
186
206
|
|
|
187
207
|
Analyze sentiment of text to determine if it is positive, negative, neutral, or mixed, including per-sentence sentiment analysis and confidence scores.
|
|
188
208
|
|
|
189
|
-
```
|
|
190
|
-
|
|
209
|
+
```ts snippet:ReadmeSampleAnalyzeSentiment
|
|
210
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
211
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
191
212
|
|
|
192
|
-
const client = new TextAnalyticsClient("<endpoint>", new
|
|
213
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
193
214
|
|
|
194
215
|
const documents = [
|
|
195
216
|
"I did not like the restaurant. The food was too spicy.",
|
|
196
217
|
"The restaurant was decorated beautifully. The atmosphere was unlike any other restaurant I've been to.",
|
|
197
218
|
"The food was yummy. :)",
|
|
198
219
|
];
|
|
220
|
+
const results = await client.analyzeSentiment(documents);
|
|
199
221
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
222
|
+
for (const result of results) {
|
|
223
|
+
if (!result.error) {
|
|
224
|
+
const { id, sentiment, confidenceScores } = result;
|
|
225
|
+
console.log(`Document ${id} has sentiment ${sentiment}`);
|
|
226
|
+
console.log(`Positive confidence score: ${confidenceScores.positive}`);
|
|
227
|
+
console.log(`Neutral confidence score: ${confidenceScores.neutral}`);
|
|
228
|
+
console.log(`Negative confidence score: ${confidenceScores.negative}`);
|
|
229
|
+
} else {
|
|
230
|
+
console.error(`Document ${result.id} has an error: ${result.error}`);
|
|
210
231
|
}
|
|
211
232
|
}
|
|
212
|
-
|
|
213
|
-
main();
|
|
214
233
|
```
|
|
215
234
|
|
|
216
235
|
To get more granular information about the opinions related to aspects of a product/service, also known as Aspect-based Sentiment Analysis in Natural Language Processing (NLP), see a sample on sentiment analysis with opinion mining [here][analyze_sentiment_opinion_mining_sample].
|
|
@@ -221,133 +240,122 @@ Recognize and categorize entities in text as people, places, organizations, date
|
|
|
221
240
|
|
|
222
241
|
The `language` parameter is optional. If it is not specified, the default English model will be used.
|
|
223
242
|
|
|
224
|
-
```
|
|
225
|
-
|
|
243
|
+
```ts snippet:ReadmeSampleRecognizeEntities
|
|
244
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
245
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
226
246
|
|
|
227
|
-
const client = new TextAnalyticsClient("<endpoint>", new
|
|
247
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
228
248
|
|
|
229
249
|
const documents = [
|
|
230
250
|
"Microsoft was founded by Bill Gates and Paul Allen.",
|
|
231
251
|
"Redmond is a city in King County, Washington, United States, located 15 miles east of Seattle.",
|
|
232
252
|
"Jeff bought three dozen eggs because there was a 50% discount.",
|
|
233
253
|
];
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
console.log(entity.text, ":", entity.category, "(Score:", entity.confidenceScore, ")");
|
|
243
|
-
}
|
|
244
|
-
} else {
|
|
245
|
-
console.error("Encountered an error:", result.error);
|
|
254
|
+
const results = await client.recognizeEntities(documents, "en");
|
|
255
|
+
|
|
256
|
+
for (const result of results) {
|
|
257
|
+
if (!result.error) {
|
|
258
|
+
const { id, entities } = result;
|
|
259
|
+
console.log(` -- Recognized entities for input ${id}--`);
|
|
260
|
+
for (const { text, category, confidenceScore } of entities) {
|
|
261
|
+
console.log(`${text}: ${category} (Score: ${confidenceScore})`);
|
|
246
262
|
}
|
|
263
|
+
} else {
|
|
264
|
+
console.error(`Document ${result.id} has an error: ${result.error}`);
|
|
247
265
|
}
|
|
248
266
|
}
|
|
249
|
-
|
|
250
|
-
main();
|
|
251
267
|
```
|
|
252
268
|
|
|
253
269
|
### Recognize PII Entities
|
|
254
270
|
|
|
255
271
|
There is a separate endpoint and operation for recognizing Personally Identifiable Information (PII) in text such as Social Security Numbers, bank account information, credit card numbers, etc. Its usage is very similar to the standard entity recognition above:
|
|
256
272
|
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
|
|
273
|
+
```ts snippet:ReadmeSampleRecognizePiiEntities
|
|
274
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
275
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
276
|
+
|
|
277
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
278
|
+
|
|
260
279
|
const documents = [
|
|
261
280
|
"The employee's SSN is 555-55-5555.",
|
|
262
281
|
"The employee's phone number is (555) 555-5555.",
|
|
263
282
|
];
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
console.error("Encountered an error:", result.error);
|
|
283
|
+
const results = await client.recognizePiiEntities(documents, "en");
|
|
284
|
+
|
|
285
|
+
for (const result of results) {
|
|
286
|
+
if (!result.error) {
|
|
287
|
+
const { id, entities } = result;
|
|
288
|
+
console.log(` -- Recognized PII entities for input ${id} --`);
|
|
289
|
+
for (const { text, category, confidenceScore } of entities) {
|
|
290
|
+
console.log(`${text}: ${category} (Score: ${confidenceScore})`);
|
|
274
291
|
}
|
|
292
|
+
} else {
|
|
293
|
+
console.error(`Document ${result.id} has an error: ${result.error}`);
|
|
275
294
|
}
|
|
276
295
|
}
|
|
277
|
-
main();
|
|
278
296
|
```
|
|
279
297
|
|
|
280
298
|
### Recognize Linked Entities
|
|
281
299
|
|
|
282
300
|
A "Linked" entity is one that exists in a knowledge base (such as Wikipedia). The `recognizeLinkedEntities` operation can disambiguate entities by determining which entry in a knowledge base they likely refer to (for example, in a piece of text, does the word "Mars" refer to the planet, or to the Roman god of war). Linked entities contain associated URLs to the knowledge base that provides the definition of the entity.
|
|
283
301
|
|
|
284
|
-
```
|
|
285
|
-
|
|
302
|
+
```ts snippet:ReadmeSampleRecognizeLinkedEntities
|
|
303
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
304
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
286
305
|
|
|
287
|
-
const client = new TextAnalyticsClient("<endpoint>", new
|
|
306
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
288
307
|
|
|
289
308
|
const documents = [
|
|
290
309
|
"Microsoft was founded by Bill Gates and Paul Allen.",
|
|
291
310
|
"Easter Island, a Chilean territory, is a remote volcanic island in Polynesia.",
|
|
292
311
|
"I use Azure Functions to develop my product.",
|
|
293
312
|
];
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
console.log(
|
|
305
|
-
" Occurrence:",
|
|
306
|
-
'"' + match.text + '"',
|
|
307
|
-
"(Score:",
|
|
308
|
-
match.confidenceScore,
|
|
309
|
-
")",
|
|
310
|
-
);
|
|
311
|
-
}
|
|
313
|
+
const results = await client.recognizeLinkedEntities(documents, "en");
|
|
314
|
+
|
|
315
|
+
for (const result of results) {
|
|
316
|
+
if (!result.error) {
|
|
317
|
+
const { id, entities } = result;
|
|
318
|
+
console.log(` -- Recognized linked entities for input ${id} --`);
|
|
319
|
+
for (const { name, url, dataSource, matches } of entities) {
|
|
320
|
+
console.log(`${name} (URL: ${url}, Source: ${dataSource})`);
|
|
321
|
+
for (const { text, confidenceScore } of matches) {
|
|
322
|
+
console.log(` Occurrence:"${text}" (Score: ${confidenceScore})`);
|
|
312
323
|
}
|
|
313
|
-
} else {
|
|
314
|
-
console.error("Encountered an error:", result.error);
|
|
315
324
|
}
|
|
325
|
+
} else {
|
|
326
|
+
console.error(`Document ${result.id} has an error: ${result.error}`);
|
|
316
327
|
}
|
|
317
328
|
}
|
|
318
|
-
|
|
319
|
-
main();
|
|
320
329
|
```
|
|
321
330
|
|
|
322
331
|
### Extract Key Phrases
|
|
323
332
|
|
|
324
333
|
Key Phrase extraction identifies the main talking points in a document. For example, given input text "The food was delicious and there were wonderful staff", the service returns "food" and "wonderful staff".
|
|
325
334
|
|
|
326
|
-
```
|
|
327
|
-
|
|
335
|
+
```ts snippet:ReadmeSampleExtractKeyPhrases
|
|
336
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
337
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
328
338
|
|
|
329
|
-
const client = new TextAnalyticsClient("<endpoint>", new
|
|
339
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
330
340
|
|
|
331
341
|
const documents = [
|
|
332
342
|
"Redmond is a city in King County, Washington, United States, located 15 miles east of Seattle.",
|
|
333
343
|
"I need to take my cat to the veterinarian.",
|
|
334
344
|
"I will travel to South America in the summer.",
|
|
335
345
|
];
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
console.log(
|
|
344
|
-
} else {
|
|
345
|
-
console.error("Encountered an error:", result.error);
|
|
346
|
+
const results = await client.extractKeyPhrases(documents, "en");
|
|
347
|
+
|
|
348
|
+
for (const result of results) {
|
|
349
|
+
if (!result.error) {
|
|
350
|
+
const { id, keyPhrases } = result;
|
|
351
|
+
console.log(` -- Extracted key phrases for input ${id} --`);
|
|
352
|
+
for (const phrase of keyPhrases) {
|
|
353
|
+
console.log(`"${phrase}"`);
|
|
346
354
|
}
|
|
355
|
+
} else {
|
|
356
|
+
console.error(`Document ${result.id} has an error: ${result.error}`);
|
|
347
357
|
}
|
|
348
358
|
}
|
|
349
|
-
|
|
350
|
-
main();
|
|
351
359
|
```
|
|
352
360
|
|
|
353
361
|
### Detect Language
|
|
@@ -356,83 +364,72 @@ Determine the language of a piece of text.
|
|
|
356
364
|
|
|
357
365
|
The `countryHint` parameter is optional, but can assist the service in providing correct output if the country of origin is known. If provided, it should be set to an ISO-3166 Alpha-2 two-letter country code (such as "us" for the United States or "jp" for Japan) or to the value `"none"`. If the parameter is not provided, then the default `"us"` (United States) model will be used. If you do not know the country of origin of the document, then the parameter `"none"` should be used, and the Text Analytics service will apply a model that is tuned for an unknown country of origin.
|
|
358
366
|
|
|
359
|
-
```
|
|
360
|
-
|
|
367
|
+
```ts snippet:ReadmeSampleDetectLanguage
|
|
368
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
369
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
361
370
|
|
|
362
|
-
const client = new TextAnalyticsClient("<endpoint>", new
|
|
371
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
363
372
|
|
|
364
373
|
const documents = [
|
|
365
374
|
"This is written in English.",
|
|
366
375
|
"Il documento scritto in italiano.",
|
|
367
376
|
"Dies ist in deutscher Sprache verfasst.",
|
|
368
377
|
];
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
primaryLanguage.name,
|
|
381
|
-
"( ISO6391:",
|
|
382
|
-
primaryLanguage.iso6391Name,
|
|
383
|
-
", Score:",
|
|
384
|
-
primaryLanguage.confidenceScore,
|
|
385
|
-
")",
|
|
386
|
-
);
|
|
387
|
-
} else {
|
|
388
|
-
console.error("Encountered an error:", result.error);
|
|
389
|
-
}
|
|
378
|
+
const results = await client.detectLanguage(documents, "none");
|
|
379
|
+
|
|
380
|
+
for (const result of results) {
|
|
381
|
+
if (!result.error) {
|
|
382
|
+
const { id, primaryLanguage } = result;
|
|
383
|
+
const { name, iso6391Name, confidenceScore } = primaryLanguage;
|
|
384
|
+
console.log(
|
|
385
|
+
`Input #${id} identified as ${name} (ISO6391: ${iso6391Name}, Score: ${confidenceScore})`,
|
|
386
|
+
);
|
|
387
|
+
} else {
|
|
388
|
+
console.error(`Document ${result.id} has an error: ${result.error}`);
|
|
390
389
|
}
|
|
391
390
|
}
|
|
392
|
-
|
|
393
|
-
main();
|
|
394
391
|
```
|
|
395
392
|
|
|
396
393
|
### Analyze Healthcare Entities
|
|
397
394
|
|
|
398
395
|
Healthcare analysis identifies healthcare entities. For example, given input text "Prescribed 100mg ibuprofen, taken twice daily", the service returns "100mg" categorized as Dosage, "ibuprofen" as MedicationName, and "twice daily" as Frequency.
|
|
399
396
|
|
|
400
|
-
```
|
|
401
|
-
|
|
397
|
+
```ts snippet:ReadmeSampleAnalyzeHealthcareEntities
|
|
398
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
399
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
402
400
|
|
|
403
|
-
const client = new TextAnalyticsClient("<endpoint>", new
|
|
401
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
404
402
|
|
|
405
403
|
const documents = [
|
|
406
404
|
"Prescribed 100mg ibuprofen, taken twice daily.",
|
|
407
405
|
"Patient does not suffer from high blood pressure.",
|
|
408
406
|
];
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
407
|
+
const poller = await client.beginAnalyzeHealthcareEntities(documents);
|
|
408
|
+
const results = await poller.pollUntilDone();
|
|
409
|
+
|
|
410
|
+
for await (const result of results) {
|
|
411
|
+
console.log(`- Document ${result.id}`);
|
|
412
|
+
if (!result.error) {
|
|
413
|
+
const { entities } = result;
|
|
414
|
+
console.log("\tRecognized Entities:");
|
|
415
|
+
for (const { text, category } of entities) {
|
|
416
|
+
console.log(`\t- Entity ${text} of type ${category}`);
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
419
|
+
console.error(`Document ${result.id} has an error: ${result.error}`);
|
|
422
420
|
}
|
|
423
421
|
}
|
|
424
|
-
|
|
425
|
-
main();
|
|
426
422
|
```
|
|
427
423
|
|
|
428
424
|
### Analyze Actions
|
|
429
425
|
|
|
430
426
|
Analyze actions enables the application of multiple analyses (named actions) at once.
|
|
431
427
|
|
|
432
|
-
```
|
|
433
|
-
|
|
428
|
+
```ts snippet:ReadmeSampleAnalyzeActions
|
|
429
|
+
import { TextAnalyticsClient } from "@azure/ai-text-analytics";
|
|
430
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
434
431
|
|
|
435
|
-
const client = new TextAnalyticsClient("<endpoint>", new
|
|
432
|
+
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
|
|
436
433
|
|
|
437
434
|
const documents = [
|
|
438
435
|
"Microsoft was founded by Bill Gates and Paul Allen.",
|
|
@@ -440,64 +437,65 @@ const documents = [
|
|
|
440
437
|
"Easter Island, a Chilean territory, is a remote volcanic island in Polynesia.",
|
|
441
438
|
"I use Azure Functions to develop my product.",
|
|
442
439
|
];
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
} else {
|
|
463
|
-
console.error("\tError:", doc.error);
|
|
440
|
+
const actions = {
|
|
441
|
+
recognizeEntitiesActions: [{ modelVersion: "latest" }],
|
|
442
|
+
recognizePiiEntitiesActions: [{ modelVersion: "latest" }],
|
|
443
|
+
extractKeyPhrasesActions: [{ modelVersion: "latest" }],
|
|
444
|
+
};
|
|
445
|
+
const poller = await client.beginAnalyzeActions(documents, actions);
|
|
446
|
+
const resultPages = await poller.pollUntilDone();
|
|
447
|
+
for await (const page of resultPages) {
|
|
448
|
+
const keyPhrasesAction = page.extractKeyPhrasesResults[0];
|
|
449
|
+
if (!keyPhrasesAction.error) {
|
|
450
|
+
const { results } = keyPhrasesAction;
|
|
451
|
+
for (const doc of results) {
|
|
452
|
+
console.log(`- Document ${doc.id}`);
|
|
453
|
+
if (!doc.error) {
|
|
454
|
+
const { keyPhrases } = doc;
|
|
455
|
+
console.log("\tKey phrases:");
|
|
456
|
+
for (const phrase of keyPhrases) {
|
|
457
|
+
console.log(`\t- ${phrase}`);
|
|
464
458
|
}
|
|
459
|
+
} else {
|
|
460
|
+
console.error(`\tError: ${doc.error}`);
|
|
465
461
|
}
|
|
466
462
|
}
|
|
463
|
+
}
|
|
467
464
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
console.error("\tError:", doc.error);
|
|
465
|
+
const entitiesAction = page.recognizeEntitiesResults[0];
|
|
466
|
+
if (!entitiesAction.error) {
|
|
467
|
+
const { results } = entitiesAction;
|
|
468
|
+
for (const doc of results) {
|
|
469
|
+
console.log(`- Document ${doc.id}`);
|
|
470
|
+
if (!doc.error) {
|
|
471
|
+
const { entities } = doc;
|
|
472
|
+
console.log("\tEntities:");
|
|
473
|
+
for (const { text, category } of entities) {
|
|
474
|
+
console.log(`\t- Entity ${text} of type ${category}`);
|
|
479
475
|
}
|
|
476
|
+
} else {
|
|
477
|
+
console.error(`\tError: ${doc.error}`);
|
|
480
478
|
}
|
|
481
479
|
}
|
|
480
|
+
}
|
|
482
481
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
console.error("\tError:", doc.error);
|
|
482
|
+
const piiEntitiesAction = page.recognizePiiEntitiesResults[0];
|
|
483
|
+
if (!piiEntitiesAction.error) {
|
|
484
|
+
const { results } = piiEntitiesAction;
|
|
485
|
+
for (const doc of results) {
|
|
486
|
+
console.log(`- Document ${doc.id}`);
|
|
487
|
+
if (!doc.error) {
|
|
488
|
+
const { entities } = doc;
|
|
489
|
+
console.log("\tPii Entities:");
|
|
490
|
+
for (const { text, category } of entities) {
|
|
491
|
+
console.log(`\t- Entity ${text} of type ${category}`);
|
|
494
492
|
}
|
|
493
|
+
} else {
|
|
494
|
+
console.error(`\tError: ${doc.error}`);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
|
|
500
|
-
main();
|
|
501
499
|
```
|
|
502
500
|
|
|
503
501
|
## Troubleshooting
|
|
@@ -506,7 +504,7 @@ main();
|
|
|
506
504
|
|
|
507
505
|
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
508
506
|
|
|
509
|
-
```
|
|
507
|
+
```ts snippet:SetLogLevel
|
|
510
508
|
import { setLogLevel } from "@azure/logger";
|
|
511
509
|
|
|
512
510
|
setLogLevel("info");
|
|
@@ -526,8 +524,6 @@ If you'd like to contribute to this library, please read the [contributing guide
|
|
|
526
524
|
|
|
527
525
|
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
|
|
528
526
|
|
|
529
|
-
|
|
530
|
-
|
|
531
527
|
[azure_cli]: https://learn.microsoft.com/cli/azure
|
|
532
528
|
[azure_sub]: https://azure.microsoft.com/free/
|
|
533
529
|
[cognitive_resource]: https://learn.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account
|
|
@@ -260,13 +260,10 @@ export declare class TextAnalyticsClient {
|
|
|
260
260
|
* Creates an instance of TextAnalyticsClient.
|
|
261
261
|
*
|
|
262
262
|
* Example usage:
|
|
263
|
-
* ```ts
|
|
263
|
+
* ```ts snippet:ReadmeSampleCreateClient_KeyCredential
|
|
264
264
|
* import { TextAnalyticsClient, AzureKeyCredential } from "@azure/ai-text-analytics";
|
|
265
265
|
*
|
|
266
|
-
* const client = new TextAnalyticsClient(
|
|
267
|
-
* "<service endpoint>",
|
|
268
|
-
* new AzureKeyCredential("<api key>")
|
|
269
|
-
* );
|
|
266
|
+
* const client = new TextAnalyticsClient("<endpoint>", new AzureKeyCredential("<API key>"));
|
|
270
267
|
* ```
|
|
271
268
|
* @param endpointUrl - The URL to the TextAnalytics endpoint
|
|
272
269
|
* @param credential - Used to authenticate requests to the service.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textAnalyticsClient.d.ts","sourceRoot":"","sources":["../../src/textAnalyticsClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKvE,OAAO,KAAK,EACV,mBAAmB,EAQnB,WAAW,EACX,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC;AAE5G,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAE5F,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAKlG,OAAO,EACL,eAAe,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E,EAC3B,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,+BAA+B,CAAC;IAiC3C;;;;;;;;;;;;;OAaG;IACU,uBAAuB,CAClC,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,kCAAkC,CAAC;IAC9C;;;;;;;;OAQG;IACU,uBAAuB,CAClC,SAAS,EAAE,iBAAiB,EAAE,EAC9B,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,kCAAkC,CAAC;IAqC9C;;;;;;;;;;OAUG;IACG,8BAA8B,CAClC,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qCAAqC,GAC9C,OAAO,CAAC,mCAAmC,CAAC;IAC/C;;;;;OAKG;IACG,8BAA8B,CAClC,SAAS,EAAE,iBAAiB,EAAE,EAC9B,OAAO,CAAC,EAAE,qCAAqC,GAC9C,OAAO,CAAC,mCAAmC,CAAC;IAgC/C;;;;;;;;;;OAUG;IACU,mBAAmB,CAC9B,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,wBAAwB,CAAC;IACpC;;;;;OAKG;IACU,mBAAmB,CAC9B,SAAS,EAAE,iBAAiB,EAAE,EAC9B,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,wBAAwB,CAAC;CAqCrC"}
|
|
@@ -36,13 +36,10 @@ export class TextAnalyticsClient {
|
|
|
36
36
|
* Creates an instance of TextAnalyticsClient.
|
|
37
37
|
*
|
|
38
38
|
* Example usage:
|
|
39
|
-
* ```ts
|
|
39
|
+
* ```ts snippet:ReadmeSampleCreateClient_KeyCredential
|
|
40
40
|
* import { TextAnalyticsClient, AzureKeyCredential } from "@azure/ai-text-analytics";
|
|
41
41
|
*
|
|
42
|
-
* const client = new TextAnalyticsClient(
|
|
43
|
-
* "<service endpoint>",
|
|
44
|
-
* new AzureKeyCredential("<api key>")
|
|
45
|
-
* );
|
|
42
|
+
* const client = new TextAnalyticsClient("<endpoint>", new AzureKeyCredential("<API key>"));
|
|
46
43
|
* ```
|
|
47
44
|
* @param endpointUrl - The URL to the TextAnalytics endpoint
|
|
48
45
|
* @param credential - Used to authenticate requests to the service.
|