@@ -162,7 +162,6 @@ async function sentimentAnalysis(client){
162
162
console .log (` \t\t Sentence sentiment: ${ sentence .sentiment } ` )
163
163
console .log (` \t\t Sentences Scores:` );
164
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
165
});
167
166
});
168
167
}
@@ -182,11 +181,9 @@ ID: 0
182
181
Sentence sentiment: positive
183
182
Sentences Scores:
184
183
Positive: 1.00 Negative: 0.00 Neutral: 0.00
185
- Length: 30, Offset: 0
186
184
Sentence sentiment: neutral
187
185
Sentences Scores:
188
186
Positive: 0.21 Negative: 0.02 Neutral: 0.77
189
- Length: 30, Offset: 31
190
187
```
191
188
192
189
#### [ Version 2.1] ( #tab/version-2 )
@@ -281,7 +278,7 @@ async function entityRecognition(client){
281
278
console .log (` Document ID: ${ document .id } ` );
282
279
document .entities .forEach (entity => {
283
280
console .log (` \t Name: ${ entity .text } \t Category: ${ entity .category } \t Subcategory: ${ entity .subCategory ? entity .subCategory : " N/A" } ` );
284
- console .log (` \t Offset: ${ entity . graphemeOffset } , Length: ${ entity . graphemeLength } \ t Score: ${ entity .score } ` );
281
+ console .log (` \t Score: ${ entity .score } ` );
285
282
});
286
283
});
287
284
}
@@ -295,26 +292,26 @@ Run your code with `node index.js` in your console window.
295
292
``` console
296
293
Document ID: 0
297
294
Name: Microsoft Category: Organization Subcategory: N/A
298
- Offset: 0, Length: 9 Score: 1
295
+ Score: 1
299
296
Name: Bill Gates Category: Person Subcategory: N/A
300
- Offset: 25, Length: 10 Score: 0.67
297
+ Score: 0.67
301
298
Name: Paul Allen Category: Person Subcategory: N/A
302
- Offset: 40, Length: 10 Score: 0.81
299
+ Score: 0.81
303
300
Name: April 4, 1975 Category: DateTime Subcategory: Date
304
- Offset: 54, Length: 13 Score: 0.8
301
+ Score: 0.8
305
302
Name: interpreters Category: PersonType Subcategory: N/A
306
- Offset: 95, Length: 12 Score: 0.6
303
+ Score: 0.6
307
304
Name: 8800 Category: Quantity Subcategory: Number
308
- Offset: 123, Length: 4 Score: 0.8
305
+ Score: 0.8
309
306
Document ID: 1
310
307
Name: Microsoft Category: Organization Subcategory: N/A
311
- Offset: 21, Length: 9 Score: 0.96
308
+ Score: 0.96
312
309
Name: Redmond Category: Location Subcategory: GPE
313
- Offset: 60, Length: 7 Score: 0.09
310
+ Score: 0.09
314
311
Name: 21 Category: Quantity Subcategory: Number
315
- Offset: 71, Length: 2 Score: 0.8
312
+ Score: 0.8
316
313
Name: Seattle Category: Location Subcategory: GPE
317
- Offset: 88, Length: 7 Score: 0.31
314
+ Score: 0.31
318
315
```
319
316
320
317
## Using NER to detect personal information
@@ -334,7 +331,7 @@ async function entityPiiRecognition(client){
334
331
console .log (` Document ID: ${ document .id } ` );
335
332
document .entities .forEach (entity => {
336
333
console .log (` \t Name: ${ entity .text } \t Category: ${ entity .category } \t Subcategory: ${ entity .subCategory ? entity .subCategory : " N/A" } ` );
337
- console .log (` \t Offset: ${ entity . graphemeOffset } , Length: ${ entity . graphemeLength } \ t Score: ${ entity .score } ` );
334
+ console .log (` \t Score: ${ entity .score } ` );
338
335
});
339
336
});
340
337
}
@@ -348,7 +345,7 @@ Run your code with `node index.js` in your console window.
348
345
``` console
349
346
Document ID: 0
350
347
Name: 123-12-1234 Category: U.S. Social Security Number (SSN) Subcategory: N/A
351
- Offset: 33, Length: 11 Score: 0.85
348
+ Score: 0.85
352
349
```
353
350
354
351
## Entity Linking
@@ -369,8 +366,7 @@ async function linkedEntityRecognition(client){
369
366
console .log (` \t Name: ${ entity .name } \t ID: ${ entity .dataSourceEntityId } \t URL: ${ entity .url } \t Data Source: ${ entity .dataSource } ` );
370
367
console .log (` \t Matches:` )
371
368
entity .matches .forEach (match => {
372
- console .log (` \t\t Text: ${ match .text } ` );
373
- console .log (` \t\t Offset: ${ match .graphemeOffset } , Length: ${ match .graphemeLength } \t Score: ${ match .score .toFixed (2 )} ` );
369
+ console .log (` \t\t Text: ${ match .text } \t Score: ${ match .score .toFixed (2 )} ` );
374
370
});
375
371
});
376
372
});
@@ -386,32 +382,24 @@ Run your code with `node index.js` in your console window.
386
382
Document ID: 0
387
383
Name: Altair 8800 ID: Altair 8800 URL: https://en.wikipedia.org/wiki/Altair_8800 Data Source: Wikipedia
388
384
Matches:
389
- Text: Altair 8800
390
- Offset: 116, Length: 11 Score: 0.78
385
+ Text: Altair 8800 Score: 0.78
391
386
Name: Bill Gates ID: Bill Gates URL: https://en.wikipedia.org/wiki/Bill_Gates Data Source: Wikipedia
392
387
Matches:
393
- Text: Bill Gates
394
- Offset: 25, Length: 10 Score: 0.55
395
- Text: Gates
396
- Offset: 161, Length: 5 Score: 0.55
388
+ Text: Bill Gates Score: 0.55
389
+ Text: Gates Score: 0.55
397
390
Name: Paul Allen ID: Paul Allen URL: https://en.wikipedia.org/wiki/Paul_Allen Data Source: Wikipedia
398
391
Matches:
399
- Text: Paul Allen
400
- Offset: 40, Length: 10 Score: 0.53
392
+ Text: Paul Allen Score: 0.53
401
393
Name: Microsoft ID: Microsoft URL: https://en.wikipedia.org/wiki/Microsoft Data Source: Wikipedia
402
394
Matches:
403
- Text: Microsoft
404
- Offset: 0, Length: 9 Score: 0.47
405
- Text: Microsoft
406
- Offset: 150, Length: 9 Score: 0.47
395
+ Text: Microsoft Score: 0.47
396
+ Text: Microsoft Score: 0.47
407
397
Name: April 4 ID: April 4 URL: https://en.wikipedia.org/wiki/April_4 Data Source: Wikipedia
408
398
Matches:
409
- Text: April 4
410
- Offset: 54, Length: 7 Score: 0.25
399
+ Text: April 4 Score: 0.25
411
400
Name: BASIC ID: BASIC URL: https://en.wikipedia.org/wiki/BASIC Data Source: Wikipedia
412
401
Matches:
413
- Text: BASIC
414
- Offset: 89, Length: 5 Score: 0.28
402
+ Text: BASIC Score: 0.28
415
403
```
416
404
417
405
#### [ Version 2.1] ( #tab/version-2 )
0 commit comments