|
36 | 36 | * <code> |
37 | 37 | * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { |
38 | 38 | * Document document = Document.newBuilder().build(); |
39 | | - * AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document); |
| 39 | + * EncodingType encodingType = EncodingType.NONE; |
| 40 | + * AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document, encodingType); |
40 | 41 | * } |
41 | 42 | * </code> |
42 | 43 | * </pre> |
@@ -146,6 +147,35 @@ public LanguageServiceStub getStub() { |
146 | 147 | return stub; |
147 | 148 | } |
148 | 149 |
|
| 150 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 151 | + /** |
| 152 | + * Analyzes the sentiment of the provided text. |
| 153 | + * |
| 154 | + * <p>Sample code: |
| 155 | + * |
| 156 | + * <pre><code> |
| 157 | + * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { |
| 158 | + * Document document = Document.newBuilder().build(); |
| 159 | + * EncodingType encodingType = EncodingType.NONE; |
| 160 | + * AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document, encodingType); |
| 161 | + * } |
| 162 | + * </code></pre> |
| 163 | + * |
| 164 | + * @param document Input document. |
| 165 | + * @param encodingType The encoding type used by the API to calculate sentence offsets. |
| 166 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 167 | + */ |
| 168 | + public final AnalyzeSentimentResponse analyzeSentiment( |
| 169 | + Document document, EncodingType encodingType) { |
| 170 | + |
| 171 | + AnalyzeSentimentRequest request = |
| 172 | + AnalyzeSentimentRequest.newBuilder() |
| 173 | + .setDocument(document) |
| 174 | + .setEncodingType(encodingType) |
| 175 | + .build(); |
| 176 | + return analyzeSentiment(request); |
| 177 | + } |
| 178 | + |
149 | 179 | // AUTO-GENERATED DOCUMENTATION AND METHOD |
150 | 180 | /** |
151 | 181 | * Analyzes the sentiment of the provided text. |
@@ -245,6 +275,30 @@ public final AnalyzeEntitiesResponse analyzeEntities( |
245 | 275 | return analyzeEntities(request); |
246 | 276 | } |
247 | 277 |
|
| 278 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 279 | + /** |
| 280 | + * Finds named entities (currently proper names and common nouns) in the text along with entity |
| 281 | + * types, salience, mentions for each entity, and other properties. |
| 282 | + * |
| 283 | + * <p>Sample code: |
| 284 | + * |
| 285 | + * <pre><code> |
| 286 | + * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { |
| 287 | + * Document document = Document.newBuilder().build(); |
| 288 | + * AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(document); |
| 289 | + * } |
| 290 | + * </code></pre> |
| 291 | + * |
| 292 | + * @param document Input document. |
| 293 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 294 | + */ |
| 295 | + public final AnalyzeEntitiesResponse analyzeEntities(Document document) { |
| 296 | + |
| 297 | + AnalyzeEntitiesRequest request = |
| 298 | + AnalyzeEntitiesRequest.newBuilder().setDocument(document).build(); |
| 299 | + return analyzeEntities(request); |
| 300 | + } |
| 301 | + |
248 | 302 | // AUTO-GENERATED DOCUMENTATION AND METHOD |
249 | 303 | /** |
250 | 304 | * Finds named entities (currently proper names and common nouns) in the text along with entity |
@@ -324,6 +378,31 @@ public final AnalyzeEntitySentimentResponse analyzeEntitySentiment( |
324 | 378 | return analyzeEntitySentiment(request); |
325 | 379 | } |
326 | 380 |
|
| 381 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 382 | + /** |
| 383 | + * Finds entities, similar to |
| 384 | + * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and |
| 385 | + * analyzes sentiment associated with each entity and its mentions. |
| 386 | + * |
| 387 | + * <p>Sample code: |
| 388 | + * |
| 389 | + * <pre><code> |
| 390 | + * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { |
| 391 | + * Document document = Document.newBuilder().build(); |
| 392 | + * AnalyzeEntitySentimentResponse response = languageServiceClient.analyzeEntitySentiment(document); |
| 393 | + * } |
| 394 | + * </code></pre> |
| 395 | + * |
| 396 | + * @param document Input document. |
| 397 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 398 | + */ |
| 399 | + public final AnalyzeEntitySentimentResponse analyzeEntitySentiment(Document document) { |
| 400 | + |
| 401 | + AnalyzeEntitySentimentRequest request = |
| 402 | + AnalyzeEntitySentimentRequest.newBuilder().setDocument(document).build(); |
| 403 | + return analyzeEntitySentiment(request); |
| 404 | + } |
| 405 | + |
327 | 406 | // AUTO-GENERATED DOCUMENTATION AND METHOD |
328 | 407 | /** |
329 | 408 | * Finds entities, similar to |
@@ -404,6 +483,29 @@ public final AnalyzeSyntaxResponse analyzeSyntax(Document document, EncodingType |
404 | 483 | return analyzeSyntax(request); |
405 | 484 | } |
406 | 485 |
|
| 486 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 487 | + /** |
| 488 | + * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with |
| 489 | + * part of speech tags, dependency trees, and other properties. |
| 490 | + * |
| 491 | + * <p>Sample code: |
| 492 | + * |
| 493 | + * <pre><code> |
| 494 | + * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { |
| 495 | + * Document document = Document.newBuilder().build(); |
| 496 | + * AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document); |
| 497 | + * } |
| 498 | + * </code></pre> |
| 499 | + * |
| 500 | + * @param document Input document. |
| 501 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 502 | + */ |
| 503 | + public final AnalyzeSyntaxResponse analyzeSyntax(Document document) { |
| 504 | + |
| 505 | + AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder().setDocument(document).build(); |
| 506 | + return analyzeSyntax(request); |
| 507 | + } |
| 508 | + |
407 | 509 | // AUTO-GENERATED DOCUMENTATION AND METHOD |
408 | 510 | /** |
409 | 511 | * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with |
@@ -551,6 +653,33 @@ public final AnnotateTextResponse annotateText( |
551 | 653 | return annotateText(request); |
552 | 654 | } |
553 | 655 |
|
| 656 | + // AUTO-GENERATED DOCUMENTATION AND METHOD |
| 657 | + /** |
| 658 | + * A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and |
| 659 | + * analyzeSyntax provide in one call. |
| 660 | + * |
| 661 | + * <p>Sample code: |
| 662 | + * |
| 663 | + * <pre><code> |
| 664 | + * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { |
| 665 | + * Document document = Document.newBuilder().build(); |
| 666 | + * AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); |
| 667 | + * AnnotateTextResponse response = languageServiceClient.annotateText(document, features); |
| 668 | + * } |
| 669 | + * </code></pre> |
| 670 | + * |
| 671 | + * @param document Input document. |
| 672 | + * @param features The enabled features. |
| 673 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 674 | + */ |
| 675 | + public final AnnotateTextResponse annotateText( |
| 676 | + Document document, AnnotateTextRequest.Features features) { |
| 677 | + |
| 678 | + AnnotateTextRequest request = |
| 679 | + AnnotateTextRequest.newBuilder().setDocument(document).setFeatures(features).build(); |
| 680 | + return annotateText(request); |
| 681 | + } |
| 682 | + |
554 | 683 | // AUTO-GENERATED DOCUMENTATION AND METHOD |
555 | 684 | /** |
556 | 685 | * A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and |
|
0 commit comments