Skip to content

Commit 0a9f102

Browse files
authored
Update java-sdk.md for preview.3
1 parent 50b4ae0 commit 0a9f102

File tree

1 file changed

+24
-23
lines changed
  • articles/cognitive-services/text-analytics/includes/quickstarts

1 file changed

+24
-23
lines changed

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

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.subservice: text-analytics
88
ms.topic: include
99
ms.date: 02/26/2020
1010
ms.author: aahi
11-
ms.reviewer: tasharm, assafi
11+
ms.reviewer: tasharm, assafi, sumeh
1212
---
1313

1414
<a name="HOLTop"></a>
@@ -34,7 +34,7 @@ Add the following text analytics dependency to your project. This version of the
3434
<dependency>
3535
<groupId>com.azure</groupId>
3636
<artifactId>azure-ai-textanalytics</artifactId>
37-
<version>1.0.0-beta.2</version>
37+
<version>1.0.0-beta.3</version>
3838
</dependency>
3939
</dependencies>
4040
```
@@ -118,25 +118,25 @@ static void sentimentAnalysisExample(TextAnalyticsClient client)
118118
System.out.printf(
119119
"Recognized document sentiment: %s, positive score: %.2f, neutral score: %.2f, negative score: %.2f.%n",
120120
documentSentiment.getSentiment(),
121-
documentSentiment.getSentimentScores().getPositive(),
122-
documentSentiment.getSentimentScores().getNeutral(),
123-
documentSentiment.getSentimentScores().getNegative());
121+
documentSentiment.getConfidenceScores().getPositive(),
122+
documentSentiment.getConfidenceScores().getNeutral(),
123+
documentSentiment.getConfidenceScores().getNegative());
124124

125125
for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) {
126126
System.out.printf(
127127
"Recognized sentence sentiment: %s, positive score: %.2f, neutral score: %.2f, negative score: %.2f.%n",
128128
sentenceSentiment.getSentiment(),
129-
sentenceSentiment.getSentimentScores().getPositive(),
130-
sentenceSentiment.getSentimentScores().getNeutral(),
131-
sentenceSentiment.getSentimentScores().getNegative());
129+
sentenceSentiment.getConfidenceScores().getPositive(),
130+
sentenceSentiment.getConfidenceScores().getNeutral(),
131+
sentenceSentiment.getConfidenceScores().getNegative());
132132
}
133133
}
134134
```
135135

136136
### Output
137137

138138
```console
139-
Recognized document sentiment: positive, Positive Score: 1.00, Neutral Score: 0.00, Negative Score: 0.00.
139+
Recognized document sentiment: positive, positive score: 1.00, neutral score: 0.00, negative score: 0.00.
140140
Recognized sentence sentiment: positive, positive score: 1.00, neutral score: 0.00, negative score: 0.00.
141141
Recognized sentence sentiment: neutral, positive score: 0.21, neutral score: 0.77, negative score: 0.02.
142142
```
@@ -186,10 +186,10 @@ static void recognizeEntitiesExample(TextAnalyticsClient client)
186186
"Recognized entity: %s, entity category: %s, entity sub-category: %s, offset: %s, length: %s, score: %.2f.%n",
187187
entity.getText(),
188188
entity.getCategory(),
189-
entity.getSubCategory() == null || entity.getSubCategory().isEmpty() ? "N/A" : entity.getSubCategory(),
190-
entity.getOffset(),
191-
entity.getLength(),
192-
entity.getScore());
189+
entity.getSubCategory() != null && !entity.getSubCategory().isEmpty() ? entity.getSubCategory() : "N/A",
190+
entity.getGraphemeOffset(),
191+
entity.getGraphemeLength(),
192+
entity.getConfidenceScore());
193193
}
194194
}
195195
```
@@ -213,21 +213,22 @@ static void recognizePIIEntitiesExample(TextAnalyticsClient client)
213213

214214
for (PiiEntity entity : client.recognizePiiEntities(text)) {
215215
System.out.printf(
216-
"Recognized personal identifiable information entity: %s, entity category: %s, entity sub-category: %s, offset: %s, length: %s, score: %.2f.%n",
216+
"Recognized personal identifiable information entity: %s, entity category: %s, %nentity sub-category: %s, offset: %s, length: %s, score: %.2f.%n",
217217
entity.getText(),
218218
entity.getCategory(),
219-
entity.getSubCategory() == null || entity.getSubCategory().isEmpty() ? "N/A" : entity.getSubCategory(),
220-
entity.getOffset(),
221-
entity.getLength(),
222-
entity.getScore());
219+
entity.getSubCategory() != null && !entity.getSubCategory().isEmpty() ? entity.getSubCategory() : "N/A",
220+
entity.getGraphemeOffset(),
221+
entity.getGraphemeLength(),
222+
entity.getConfidenceScore());
223223
}
224224
}
225225
```
226226

227227
### Output
228228

229229
```console
230-
Recognized personal identifiable information entity: 123-12-1234, entity category: U.S. Social Security Number (SSN), entity sub-category: N/A, offset: 33, length: 11, score: 0.85.
230+
Recognized personal identifiable information entity: 123-12-1234, entity category: U.S. Social Security Number (SSN),
231+
entity sub-category: N/A, offset: 33, length: 11, score: 0.85.
231232
```
232233

233234
## Entity linking
@@ -248,16 +249,16 @@ static void recognizeLinkedEntitiesExample(TextAnalyticsClient client)
248249
for (LinkedEntity linkedEntity : client.recognizeLinkedEntities(text)) {
249250
System.out.printf("Name: %s, ID: %s, URL: %s, Data Source: %s.%n",
250251
linkedEntity.getName(),
251-
linkedEntity.getId(),
252+
linkedEntity.getDataSourceEntityId(),
252253
linkedEntity.getUrl(),
253254
linkedEntity.getDataSource());
254255
System.out.printf("Matches:%n");
255256
for (LinkedEntityMatch linkedEntityMatch : linkedEntity.getLinkedEntityMatches()) {
256257
System.out.printf("Text: %s, Offset: %s, Length: %s, Score: %.2f.%n",
257258
linkedEntityMatch.getText(),
258-
linkedEntityMatch.getOffset(),
259-
linkedEntityMatch.getLength(),
260-
linkedEntityMatch.getScore());
259+
linkedEntityMatch.getGraphemeOffset(),
260+
linkedEntityMatch.getGraphemeLength(),
261+
linkedEntityMatch.getConfidenceScore());
261262
}
262263
}
263264
}

0 commit comments

Comments
 (0)