Skip to content

Commit bebe3a7

Browse files
committed
updated
1 parent 7905f67 commit bebe3a7

File tree

1 file changed

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

1 file changed

+19
-19
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,21 @@ static void sentimentAnalysisExample(TextAnalyticsClient client)
115115
String text = "I had the best day of my life. I wish you were there with me.";
116116

117117
DocumentSentiment documentSentiment = client.analyzeSentiment(text);
118-
System.out.printf(
119-
"Recognized document sentiment: %s, positive score: %.2f, neutral score: %.2f, negative score: %.2f.%n",
120-
documentSentiment.getSentiment(),
121-
documentSentiment.getSentimentScores().getPositive(),
122-
documentSentiment.getSentimentScores().getNeutral(),
123-
documentSentiment.getSentimentScores().getNegative());
124-
125-
for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) {
126118
System.out.printf(
127-
"Recognized sentence sentiment: %s, positive score: %.2f, neutral score: %.2f, negative score: %.2f.%n",
128-
sentenceSentiment.getSentiment(),
129-
sentenceSentiment.getSentimentScores().getPositive(),
130-
sentenceSentiment.getSentimentScores().getNeutral(),
131-
sentenceSentiment.getSentimentScores().getNegative());
132-
}
119+
"Recognized document sentiment: %s, positive score: %.2f, neutral score: %.2f, negative score: %.2f.%n",
120+
documentSentiment.getSentiment(),
121+
documentSentiment.getSentimentScores().getPositive(),
122+
documentSentiment.getSentimentScores().getNeutral(),
123+
documentSentiment.getSentimentScores().getNegative());
124+
125+
for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) {
126+
System.out.printf(
127+
"Recognized sentence sentiment: %s, positive score: %.2f, neutral score: %.2f, negative score: %.2f.%n",
128+
sentenceSentiment.getSentiment(),
129+
sentenceSentiment.getSentimentScores().getPositive(),
130+
sentenceSentiment.getSentimentScores().getNeutral(),
131+
sentenceSentiment.getSentimentScores().getNegative());
132+
}
133133
}
134134
```
135135

@@ -154,7 +154,7 @@ static void detectLanguageExample(TextAnalyticsClient client)
154154
String text = "Ce document est rédigé en Français.";
155155

156156
DetectedLanguage detectedLanguage = client.detectLanguage(text);
157-
System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %s.%n",
157+
System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %.2f.%n",
158158
detectedLanguage.getName(),
159159
detectedLanguage.getIso6391Name(),
160160
detectedLanguage.getScore());
@@ -164,7 +164,7 @@ static void detectLanguageExample(TextAnalyticsClient client)
164164
### Output
165165

166166
```console
167-
Detected primary language: French, ISO 6391 name: fr, score: 1.0.
167+
Detected primary language: French, ISO 6391 name: fr, score: 1.00.
168168
```
169169
## Named Entity recognition (NER)
170170

@@ -183,7 +183,7 @@ static void recognizeEntitiesExample(TextAnalyticsClient client)
183183

184184
for (CategorizedEntity entity : client.recognizeEntities(text)) {
185185
System.out.printf(
186-
"Recognized entity: %s, entity category: %s, entity sub-category: %s, offset: %s, length: %s, score: %s.%n",
186+
"Recognized entity: %s, entity category: %s, entity sub-category: %s, offset: %s, length: %s, score: %.2f.%n",
187187
entity.getText(),
188188
entity.getCategory(),
189189
entity.getSubCategory() == null || entity.getSubCategory().isEmpty() ? "N/A" : entity.getSubCategory(),
@@ -198,7 +198,7 @@ static void recognizeEntitiesExample(TextAnalyticsClient client)
198198

199199
```console
200200
Recognized entity: Seattle, entity category: Location, entity sub-category: GPE, offset: 26, length: 7, score: 0.92.
201-
Recognized entity: last week, entity category: DateTime, entity sub-category: DateRange, offset: 34, length: 9, score: 0.8.
201+
Recognized entity: last week, entity category: DateTime, entity sub-category: DateRange, offset: 34, length: 9, score: 0.80.
202202
```
203203

204204
## Using NER to detect personal information
@@ -213,7 +213,7 @@ 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: %s.%n",
216+
"Recognized personal identifiable information entity: %s, entity category: %s, entity sub-category: %s, offset: %s, length: %s, score: %.2f.%n",
217217
entity.getText(),
218218
entity.getCategory(),
219219
entity.getSubCategory() == null || entity.getSubCategory().isEmpty() ? "N/A" : entity.getSubCategory(),

0 commit comments

Comments
 (0)