Skip to content

Commit b72b6bb

Browse files
authored
Merge pull request #44 from suhas92/sumeh/update-java-qs
update Java QS for preview.5
2 parents a002e32 + 9d7b6a8 commit b72b6bb

File tree

1 file changed

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

1 file changed

+27
-26
lines changed

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

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Create a Maven project in your preferred IDE or development environment. Then ad
3434
<dependency>
3535
<groupId>com.azure</groupId>
3636
<artifactId>azure-ai-textanalytics</artifactId>
37-
<version>1.0.0-beta.4</version>
37+
<version>1.0.0-beta.5</version>
3838
</dependency>
3939
</dependencies>
4040
```
@@ -97,7 +97,7 @@ Create a method to instantiate the `TextAnalyticsClient` object with the key and
9797
```java
9898
static TextAnalyticsClient authenticateClient(String key, String endpoint) {
9999
return new TextAnalyticsClientBuilder()
100-
.apiKey(new AzureKeyCredential(key))
100+
.credential(new AzureKeyCredential(key))
101101
.endpoint(endpoint)
102102
.buildClient();
103103
}
@@ -130,8 +130,8 @@ static void sentimentAnalysisExample(TextAnalyticsClient client)
130130
sentenceSentiment.getConfidenceScores().getPositive(),
131131
sentenceSentiment.getConfidenceScores().getNeutral(),
132132
sentenceSentiment.getConfidenceScores().getNegative());
133+
}
133134
}
134-
}
135135
```
136136

137137
### Output
@@ -159,7 +159,7 @@ static void detectLanguageExample(TextAnalyticsClient client)
159159
System.out.printf("Detected primary language: %s, ISO 6391 name: %s, score: %.2f.%n",
160160
detectedLanguage.getName(),
161161
detectedLanguage.getIso6391Name(),
162-
detectedLanguage.getScore());
162+
detectedLanguage.getConfidenceScore());
163163
}
164164
```
165165

@@ -171,7 +171,7 @@ Detected primary language: French, ISO 6391 name: fr, score: 1.00.
171171
## Named Entity recognition (NER)
172172

173173
> [!NOTE]
174-
> In version `3.0-preview`:
174+
> In version `3.0`:
175175
> * NER includes separate methods for detecting personal information.
176176
> * Entity linking is a separate request than NER.
177177
@@ -188,7 +188,7 @@ static void recognizeEntitiesExample(TextAnalyticsClient client)
188188
"Recognized entity: %s, entity category: %s, entity sub-category: %s, score: %s.%n",
189189
entity.getText(),
190190
entity.getCategory(),
191-
entity.getSubCategory(),
191+
entity.getSubcategory(),
192192
entity.getConfidenceScore());
193193
}
194194
}
@@ -197,7 +197,8 @@ static void recognizeEntitiesExample(TextAnalyticsClient client)
197197
### Output
198198

199199
```console
200-
Recognized entity: Seattle, entity category: Location, entity sub-category: GPE, score: 0.92.
200+
Recognized entity: trip, entity category: Event, entity sub-category: null, score: 0.61.
201+
Recognized entity: Seattle, entity category: Location, entity sub-category: GPE, score: 0.82.
201202
Recognized entity: last week, entity category: DateTime, entity sub-category: DateRange, score: 0.8.
202203
```
203204

@@ -210,23 +211,23 @@ static void recognizeLinkedEntitiesExample(TextAnalyticsClient client)
210211
{
211212
// The text that need be analyzed.
212213
String text = "Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975, " +
213-
"to develop and sell BASIC interpreters for the Altair 8800. " +
214-
"During his career at Microsoft, Gates held the positions of chairman, " +
215-
"chief executive officer, president and chief software architect, " +
216-
"while also being the largest individual shareholder until May 2014.";
214+
"to develop and sell BASIC interpreters for the Altair 8800. " +
215+
"During his career at Microsoft, Gates held the positions of chairman, " +
216+
"chief executive officer, president and chief software architect, " +
217+
"while also being the largest individual shareholder until May 2014.";
217218

218219
System.out.printf("Linked Entities:%n");
219220
for (LinkedEntity linkedEntity : client.recognizeLinkedEntities(text)) {
220221
System.out.printf("Name: %s, ID: %s, URL: %s, Data Source: %s.%n",
221-
linkedEntity.getName(),
222-
linkedEntity.getDataSourceEntityId(),
223-
linkedEntity.getUrl(),
224-
linkedEntity.getDataSource());
222+
linkedEntity.getName(),
223+
linkedEntity.getDataSourceEntityId(),
224+
linkedEntity.getUrl(),
225+
linkedEntity.getDataSource());
225226
System.out.printf("Matches:%n");
226-
for (LinkedEntityMatch linkedEntityMatch : linkedEntity.getLinkedEntityMatches()) {
227+
for (LinkedEntityMatch linkedEntityMatch : linkedEntity.getMatches()) {
227228
System.out.printf("Text: %s, Score: %.2f%n",
228-
linkedEntityMatch.getText(),
229-
linkedEntityMatch.getConfidenceScore());
229+
linkedEntityMatch.getText(),
230+
linkedEntityMatch.getConfidenceScore());
230231
}
231232
}
232233
}
@@ -238,24 +239,24 @@ static void recognizeLinkedEntitiesExample(TextAnalyticsClient client)
238239
Linked Entities:
239240
Name: Altair 8800, ID: Altair 8800, URL: https://en.wikipedia.org/wiki/Altair_8800, Data Source: Wikipedia.
240241
Matches:
241-
Text: Altair 8800, Score: 0.78
242+
Text: Altair 8800, Score: 0.88
242243
Name: Bill Gates, ID: Bill Gates, URL: https://en.wikipedia.org/wiki/Bill_Gates, Data Source: Wikipedia.
243244
Matches:
244-
Text: Bill Gates, Score: 0.55
245-
Text: Gates, Score: 0.55
245+
Text: Bill Gates, Score: 0.63
246+
Text: Gates, Score: 0.63
246247
Name: Paul Allen, ID: Paul Allen, URL: https://en.wikipedia.org/wiki/Paul_Allen, Data Source: Wikipedia.
247248
Matches:
248-
Text: Paul Allen, Score: 0.53
249+
Text: Paul Allen, Score: 0.60
249250
Name: Microsoft, ID: Microsoft, URL: https://en.wikipedia.org/wiki/Microsoft, Data Source: Wikipedia.
250251
Matches:
251-
Text: Microsoft, Score: 0.47
252-
Text: Microsoft, Score: 0.47
252+
Text: Microsoft, Score: 0.55
253+
Text: Microsoft, Score: 0.55
253254
Name: April 4, ID: April 4, URL: https://en.wikipedia.org/wiki/April_4, Data Source: Wikipedia.
254255
Matches:
255-
Text: April 4, Score: 0.25
256+
Text: April 4, Score: 0.32
256257
Name: BASIC, ID: BASIC, URL: https://en.wikipedia.org/wiki/BASIC, Data Source: Wikipedia.
257258
Matches:
258-
Text: BASIC, Score: 0.28
259+
Text: BASIC, Score: 0.33
259260
```
260261
## Key phrase extraction
261262

0 commit comments

Comments
 (0)