Skip to content

Commit b27e3b6

Browse files
authored
removed graphemeOffset and graphemeLength
1 parent 99e2eb2 commit b27e3b6

File tree

1 file changed

+22
-34
lines changed
  • articles/cognitive-services/text-analytics/includes/quickstarts

1 file changed

+22
-34
lines changed

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

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ async function sentimentAnalysis(client){
162162
console.log(`\t\tSentence sentiment: ${sentence.sentiment}`)
163163
console.log(`\t\tSentences Scores:`);
164164
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}`);
166165
});
167166
});
168167
}
@@ -182,11 +181,9 @@ ID: 0
182181
Sentence sentiment: positive
183182
Sentences Scores:
184183
Positive: 1.00 Negative: 0.00 Neutral: 0.00
185-
Length: 30, Offset: 0
186184
Sentence sentiment: neutral
187185
Sentences Scores:
188186
Positive: 0.21 Negative: 0.02 Neutral: 0.77
189-
Length: 30, Offset: 31
190187
```
191188

192189
#### [Version 2.1](#tab/version-2)
@@ -281,7 +278,7 @@ async function entityRecognition(client){
281278
console.log(`Document ID: ${document.id}`);
282279
document.entities.forEach(entity => {
283280
console.log(`\tName: ${entity.text} \tCategory: ${entity.category} \tSubcategory: ${entity.subCategory ? entity.subCategory : "N/A"}`);
284-
console.log(`\tOffset: ${entity.graphemeOffset}, Length: ${entity.graphemeLength} \tScore: ${entity.score}`);
281+
console.log(`\tScore: ${entity.score}`);
285282
});
286283
});
287284
}
@@ -295,26 +292,26 @@ Run your code with `node index.js` in your console window.
295292
```console
296293
Document ID: 0
297294
Name: Microsoft Category: Organization Subcategory: N/A
298-
Offset: 0, Length: 9 Score: 1
295+
Score: 1
299296
Name: Bill Gates Category: Person Subcategory: N/A
300-
Offset: 25, Length: 10 Score: 0.67
297+
Score: 0.67
301298
Name: Paul Allen Category: Person Subcategory: N/A
302-
Offset: 40, Length: 10 Score: 0.81
299+
Score: 0.81
303300
Name: April 4, 1975 Category: DateTime Subcategory: Date
304-
Offset: 54, Length: 13 Score: 0.8
301+
Score: 0.8
305302
Name: interpreters Category: PersonType Subcategory: N/A
306-
Offset: 95, Length: 12 Score: 0.6
303+
Score: 0.6
307304
Name: 8800 Category: Quantity Subcategory: Number
308-
Offset: 123, Length: 4 Score: 0.8
305+
Score: 0.8
309306
Document ID: 1
310307
Name: Microsoft Category: Organization Subcategory: N/A
311-
Offset: 21, Length: 9 Score: 0.96
308+
Score: 0.96
312309
Name: Redmond Category: Location Subcategory: GPE
313-
Offset: 60, Length: 7 Score: 0.09
310+
Score: 0.09
314311
Name: 21 Category: Quantity Subcategory: Number
315-
Offset: 71, Length: 2 Score: 0.8
312+
Score: 0.8
316313
Name: Seattle Category: Location Subcategory: GPE
317-
Offset: 88, Length: 7 Score: 0.31
314+
Score: 0.31
318315
```
319316

320317
## Using NER to detect personal information
@@ -334,7 +331,7 @@ async function entityPiiRecognition(client){
334331
console.log(`Document ID: ${document.id}`);
335332
document.entities.forEach(entity => {
336333
console.log(`\tName: ${entity.text} \tCategory: ${entity.category} \tSubcategory: ${entity.subCategory ? entity.subCategory : "N/A"}`);
337-
console.log(`\tOffset: ${entity.graphemeOffset}, Length: ${entity.graphemeLength} \tScore: ${entity.score}`);
334+
console.log(`\tScore: ${entity.score}`);
338335
});
339336
});
340337
}
@@ -348,7 +345,7 @@ Run your code with `node index.js` in your console window.
348345
```console
349346
Document ID: 0
350347
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
352349
```
353350

354351
## Entity Linking
@@ -369,8 +366,7 @@ async function linkedEntityRecognition(client){
369366
console.log(`\tName: ${entity.name} \tID: ${entity.dataSourceEntityId} \tURL: ${entity.url} \tData Source: ${entity.dataSource}`);
370367
console.log(`\tMatches:`)
371368
entity.matches.forEach(match => {
372-
console.log(`\t\tText: ${match.text}`);
373-
console.log(`\t\tOffset: ${match.graphemeOffset}, Length: ${match.graphemeLength} \tScore: ${match.score.toFixed(2)}`);
369+
console.log(`\t\tText: ${match.text} \tScore: ${match.score.toFixed(2)}`);
374370
});
375371
});
376372
});
@@ -386,32 +382,24 @@ Run your code with `node index.js` in your console window.
386382
Document ID: 0
387383
Name: Altair 8800 ID: Altair 8800 URL: https://en.wikipedia.org/wiki/Altair_8800 Data Source: Wikipedia
388384
Matches:
389-
Text: Altair 8800
390-
Offset: 116, Length: 11 Score: 0.78
385+
Text: Altair 8800 Score: 0.78
391386
Name: Bill Gates ID: Bill Gates URL: https://en.wikipedia.org/wiki/Bill_Gates Data Source: Wikipedia
392387
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
397390
Name: Paul Allen ID: Paul Allen URL: https://en.wikipedia.org/wiki/Paul_Allen Data Source: Wikipedia
398391
Matches:
399-
Text: Paul Allen
400-
Offset: 40, Length: 10 Score: 0.53
392+
Text: Paul Allen Score: 0.53
401393
Name: Microsoft ID: Microsoft URL: https://en.wikipedia.org/wiki/Microsoft Data Source: Wikipedia
402394
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
407397
Name: April 4 ID: April 4 URL: https://en.wikipedia.org/wiki/April_4 Data Source: Wikipedia
408398
Matches:
409-
Text: April 4
410-
Offset: 54, Length: 7 Score: 0.25
399+
Text: April 4 Score: 0.25
411400
Name: BASIC ID: BASIC URL: https://en.wikipedia.org/wiki/BASIC Data Source: Wikipedia
412401
Matches:
413-
Text: BASIC
414-
Offset: 89, Length: 5 Score: 0.28
402+
Text: BASIC Score: 0.28
415403
```
416404

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

0 commit comments

Comments
 (0)