Skip to content

Commit 99e2eb2

Browse files
authored
Update JS Quickstarts with preview.3
1 parent a0cc270 commit 99e2eb2

File tree

1 file changed

+17
-16
lines changed
  • articles/cognitive-services/text-analytics/includes/quickstarts

1 file changed

+17
-16
lines changed

articles/cognitive-services/text-analytics/includes/quickstarts/nodejs-sdk.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ async function sentimentAnalysis(client){
156156
console.log(`ID: ${document.id}`);
157157
console.log(`\tDocument Sentiment: ${document.sentiment}`);
158158
console.log(`\tDocument Scores:`);
159-
console.log(`\t\tPositive: ${document.sentimentScores.positive.toFixed(2)} \tNegative: ${document.sentimentScores.negative.toFixed(2)} \tNeutral: ${document.sentimentScores.neutral.toFixed(2)}`);
159+
console.log(`\t\tPositive: ${document.confidenceScores.positive.toFixed(2)} \tNegative: ${document.confidenceScores.negative.toFixed(2)} \tNeutral: ${document.confidenceScores.neutral.toFixed(2)}`);
160160
console.log(`\tSentences Sentiment(${document.sentences.length}):`);
161161
document.sentences.forEach(sentence => {
162162
console.log(`\t\tSentence sentiment: ${sentence.sentiment}`)
163163
console.log(`\t\tSentences Scores:`);
164-
console.log(`\t\tPositive: ${sentence.sentimentScores.positive.toFixed(2)} \tNegative: ${sentence.sentimentScores.negative.toFixed(2)} \tNeutral: ${sentence.sentimentScores.neutral.toFixed(2)}`);
165-
console.log(`\t\tLength: ${sentence.length}, Offset: ${sentence.offset}`);
166-
})
164+
console.log(`\t\tPositive: ${sentence.confidenceScores.positive.toFixed(2)} \tNegative: ${sentence.confidenceScores.negative.toFixed(2)} \tNeutral: ${sentence.confidenceScores.neutral.toFixed(2)}`);
165+
console.log(`\t\tLength: ${sentence.graphemeLength}, Offset: ${sentence.graphemeOffset}`);
166+
});
167167
});
168168
}
169169
sentimentAnalysis(textAnalyticsClient)
@@ -281,7 +281,7 @@ async function entityRecognition(client){
281281
console.log(`Document ID: ${document.id}`);
282282
document.entities.forEach(entity => {
283283
console.log(`\tName: ${entity.text} \tCategory: ${entity.category} \tSubcategory: ${entity.subCategory ? entity.subCategory : "N/A"}`);
284-
console.log(`\tOffset: ${entity.offset}, Length: ${entity.length} \tScore: ${entity.score}`);
284+
console.log(`\tOffset: ${entity.graphemeOffset}, Length: ${entity.graphemeLength} \tScore: ${entity.score}`);
285285
});
286286
});
287287
}
@@ -314,6 +314,7 @@ Document ID: 1
314314
Name: 21 Category: Quantity Subcategory: Number
315315
Offset: 71, Length: 2 Score: 0.8
316316
Name: Seattle Category: Location Subcategory: GPE
317+
Offset: 88, Length: 7 Score: 0.31
317318
```
318319

319320
## Using NER to detect personal information
@@ -333,7 +334,7 @@ async function entityPiiRecognition(client){
333334
console.log(`Document ID: ${document.id}`);
334335
document.entities.forEach(entity => {
335336
console.log(`\tName: ${entity.text} \tCategory: ${entity.category} \tSubcategory: ${entity.subCategory ? entity.subCategory : "N/A"}`);
336-
console.log(`\tOffset: ${entity.offset}, Length: ${entity.length} \tScore: ${entity.score}`);
337+
console.log(`\tOffset: ${entity.graphemeOffset}, Length: ${entity.graphemeLength} \tScore: ${entity.score}`);
337338
});
338339
});
339340
}
@@ -365,11 +366,11 @@ async function linkedEntityRecognition(client){
365366
entityResults.forEach(document => {
366367
console.log(`Document ID: ${document.id}`);
367368
document.entities.forEach(entity => {
368-
console.log(`\tName: ${entity.name} \tID: ${entity.id} \tURL: ${entity.url} \tData Source: ${entity.dataSource}`);
369+
console.log(`\tName: ${entity.name} \tID: ${entity.dataSourceEntityId} \tURL: ${entity.url} \tData Source: ${entity.dataSource}`);
369370
console.log(`\tMatches:`)
370371
entity.matches.forEach(match => {
371372
console.log(`\t\tText: ${match.text}`);
372-
console.log(`\t\tOffset: ${match.offset}, Length: ${match.length} \tScore: ${match.score.toFixed(3)}`);
373+
console.log(`\t\tOffset: ${match.graphemeOffset}, Length: ${match.graphemeLength} \tScore: ${match.score.toFixed(2)}`);
373374
});
374375
});
375376
});
@@ -386,31 +387,31 @@ Document ID: 0
386387
Name: Altair 8800 ID: Altair 8800 URL: https://en.wikipedia.org/wiki/Altair_8800 Data Source: Wikipedia
387388
Matches:
388389
Text: Altair 8800
389-
Offset: 116, Length: 11 Score: 0.777
390+
Offset: 116, Length: 11 Score: 0.78
390391
Name: Bill Gates ID: Bill Gates URL: https://en.wikipedia.org/wiki/Bill_Gates Data Source: Wikipedia
391392
Matches:
392393
Text: Bill Gates
393-
Offset: 25, Length: 10 Score: 0.555
394+
Offset: 25, Length: 10 Score: 0.55
394395
Text: Gates
395-
Offset: 161, Length: 5 Score: 0.555
396+
Offset: 161, Length: 5 Score: 0.55
396397
Name: Paul Allen ID: Paul Allen URL: https://en.wikipedia.org/wiki/Paul_Allen Data Source: Wikipedia
397398
Matches:
398399
Text: Paul Allen
399-
Offset: 40, Length: 10 Score: 0.533
400+
Offset: 40, Length: 10 Score: 0.53
400401
Name: Microsoft ID: Microsoft URL: https://en.wikipedia.org/wiki/Microsoft Data Source: Wikipedia
401402
Matches:
402403
Text: Microsoft
403-
Offset: 0, Length: 9 Score: 0.469
404+
Offset: 0, Length: 9 Score: 0.47
404405
Text: Microsoft
405-
Offset: 150, Length: 9 Score: 0.469
406+
Offset: 150, Length: 9 Score: 0.47
406407
Name: April 4 ID: April 4 URL: https://en.wikipedia.org/wiki/April_4 Data Source: Wikipedia
407408
Matches:
408409
Text: April 4
409-
Offset: 54, Length: 7 Score: 0.248
410+
Offset: 54, Length: 7 Score: 0.25
410411
Name: BASIC ID: BASIC URL: https://en.wikipedia.org/wiki/BASIC Data Source: Wikipedia
411412
Matches:
412413
Text: BASIC
413-
Offset: 89, Length: 5 Score: 0.281
414+
Offset: 89, Length: 5 Score: 0.28
414415
```
415416

416417
#### [Version 2.1](#tab/version-2)

0 commit comments

Comments
 (0)