@@ -156,14 +156,14 @@ async function sentimentAnalysis(client){
156
156
console .log (` ID: ${ document .id } ` );
157
157
console .log (` \t Document Sentiment: ${ document .sentiment } ` );
158
158
console .log (` \t Document Scores:` );
159
- console .log (` \t\t Positive: ${ document .sentimentScores .positive .toFixed (2 )} \t Negative: ${ document .sentimentScores .negative .toFixed (2 )} \t Neutral: ${ document .sentimentScores .neutral .toFixed (2 )} ` );
159
+ console .log (` \t\t Positive: ${ document .confidenceScores .positive .toFixed (2 )} \t Negative: ${ document .confidenceScores .negative .toFixed (2 )} \t Neutral: ${ document .confidenceScores .neutral .toFixed (2 )} ` );
160
160
console .log (` \t Sentences Sentiment(${ document .sentences .length } ):` );
161
161
document .sentences .forEach (sentence => {
162
162
console .log (` \t\t Sentence sentiment: ${ sentence .sentiment } ` )
163
163
console .log (` \t\t Sentences Scores:` );
164
- console .log (` \t\t Positive: ${ sentence .sentimentScores .positive .toFixed (2 )} \t Negative: ${ sentence .sentimentScores .negative .toFixed (2 )} \t Neutral: ${ sentence .sentimentScores .neutral .toFixed (2 )} ` );
165
- console .log (` \t\t Length: ${ sentence .length } , Offset: ${ sentence .offset } ` );
166
- })
164
+ console .log (` \t\t Positive: ${ sentence .confidenceScores .positive .toFixed (2 )} \t Negative: ${ sentence .confidenceScores .negative .toFixed (2 )} \t Neutral: ${ sentence .confidenceScores .neutral .toFixed (2 )} ` );
165
+ console .log (` \t\t Length: ${ sentence .graphemeLength } , Offset: ${ sentence .graphemeOffset } ` );
166
+ });
167
167
});
168
168
}
169
169
sentimentAnalysis (textAnalyticsClient)
@@ -281,7 +281,7 @@ async function entityRecognition(client){
281
281
console .log (` Document ID: ${ document .id } ` );
282
282
document .entities .forEach (entity => {
283
283
console .log (` \t Name: ${ entity .text } \t Category: ${ entity .category } \t Subcategory: ${ entity .subCategory ? entity .subCategory : " N/A" } ` );
284
- console .log (` \t Offset: ${ entity .offset } , Length: ${ entity .length } \t Score: ${ entity .score } ` );
284
+ console .log (` \t Offset: ${ entity .graphemeOffset } , Length: ${ entity .graphemeLength } \t Score: ${ entity .score } ` );
285
285
});
286
286
});
287
287
}
@@ -314,6 +314,7 @@ Document ID: 1
314
314
Name: 21 Category: Quantity Subcategory: Number
315
315
Offset: 71, Length: 2 Score: 0.8
316
316
Name: Seattle Category: Location Subcategory: GPE
317
+ Offset: 88, Length: 7 Score: 0.31
317
318
```
318
319
319
320
## Using NER to detect personal information
@@ -333,7 +334,7 @@ async function entityPiiRecognition(client){
333
334
console .log (` Document ID: ${ document .id } ` );
334
335
document .entities .forEach (entity => {
335
336
console .log (` \t Name: ${ entity .text } \t Category: ${ entity .category } \t Subcategory: ${ entity .subCategory ? entity .subCategory : " N/A" } ` );
336
- console .log (` \t Offset: ${ entity .offset } , Length: ${ entity .length } \t Score: ${ entity .score } ` );
337
+ console .log (` \t Offset: ${ entity .graphemeOffset } , Length: ${ entity .graphemeLength } \t Score: ${ entity .score } ` );
337
338
});
338
339
});
339
340
}
@@ -365,11 +366,11 @@ async function linkedEntityRecognition(client){
365
366
entityResults .forEach (document => {
366
367
console .log (` Document ID: ${ document .id } ` );
367
368
document .entities .forEach (entity => {
368
- console .log (` \t Name: ${ entity .name } \t ID: ${ entity .id } \t URL: ${ entity .url } \t Data Source: ${ entity .dataSource } ` );
369
+ console .log (` \t Name: ${ entity .name } \t ID: ${ entity .dataSourceEntityId } \t URL: ${ entity .url } \t Data Source: ${ entity .dataSource } ` );
369
370
console .log (` \t Matches:` )
370
371
entity .matches .forEach (match => {
371
372
console .log (` \t\t Text: ${ match .text } ` );
372
- console .log (` \t\t Offset: ${ match .offset } , Length: ${ match .length } \t Score: ${ match .score .toFixed (3 )} ` );
373
+ console .log (` \t\t Offset: ${ match .graphemeOffset } , Length: ${ match .graphemeLength } \t Score: ${ match .score .toFixed (2 )} ` );
373
374
});
374
375
});
375
376
});
@@ -386,31 +387,31 @@ Document ID: 0
386
387
Name: Altair 8800 ID: Altair 8800 URL: https://en.wikipedia.org/wiki/Altair_8800 Data Source: Wikipedia
387
388
Matches:
388
389
Text: Altair 8800
389
- Offset: 116, Length: 11 Score: 0.777
390
+ Offset: 116, Length: 11 Score: 0.78
390
391
Name: Bill Gates ID: Bill Gates URL: https://en.wikipedia.org/wiki/Bill_Gates Data Source: Wikipedia
391
392
Matches:
392
393
Text: Bill Gates
393
- Offset: 25, Length: 10 Score: 0.555
394
+ Offset: 25, Length: 10 Score: 0.55
394
395
Text: Gates
395
- Offset: 161, Length: 5 Score: 0.555
396
+ Offset: 161, Length: 5 Score: 0.55
396
397
Name: Paul Allen ID: Paul Allen URL: https://en.wikipedia.org/wiki/Paul_Allen Data Source: Wikipedia
397
398
Matches:
398
399
Text: Paul Allen
399
- Offset: 40, Length: 10 Score: 0.533
400
+ Offset: 40, Length: 10 Score: 0.53
400
401
Name: Microsoft ID: Microsoft URL: https://en.wikipedia.org/wiki/Microsoft Data Source: Wikipedia
401
402
Matches:
402
403
Text: Microsoft
403
- Offset: 0, Length: 9 Score: 0.469
404
+ Offset: 0, Length: 9 Score: 0.47
404
405
Text: Microsoft
405
- Offset: 150, Length: 9 Score: 0.469
406
+ Offset: 150, Length: 9 Score: 0.47
406
407
Name: April 4 ID: April 4 URL: https://en.wikipedia.org/wiki/April_4 Data Source: Wikipedia
407
408
Matches:
408
409
Text: April 4
409
- Offset: 54, Length: 7 Score: 0.248
410
+ Offset: 54, Length: 7 Score: 0.25
410
411
Name: BASIC ID: BASIC URL: https://en.wikipedia.org/wiki/BASIC Data Source: Wikipedia
411
412
Matches:
412
413
Text: BASIC
413
- Offset: 89, Length: 5 Score: 0.281
414
+ Offset: 89, Length: 5 Score: 0.28
414
415
```
415
416
416
417
#### [ Version 2.1] ( #tab/version-2 )
0 commit comments