Source:
public void analyzeBatchSentimentMaxOverloadWithOpinionMining() { List<TextDocumentInput> textDocumentInputs = Arrays.asList( new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.") .setLanguage("en"), new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.") .setLanguage("en") ); AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true) .setIncludeStatistics(true); Response<AnalyzeSentimentResultCollection> response = textAnalyticsClient.analyzeSentimentBatchWithResponse(textDocumentInputs, options, Context.NONE); System.out.printf("Status code of request response: %d%n", response.getStatusCode()); AnalyzeSentimentResultCollection resultCollection = response.getValue(); TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics(); System.out.printf("A batch of documents statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); resultCollection.forEach(analyzeSentimentResult -> { System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); documentSentiment.getSentences().forEach(sentenceSentiment -> { System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { AspectSentiment aspectSentiment = minedOpinions.getAspect(); System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(), aspectSentiment.getText()); for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the aspect negated: %s.%n", opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated()); } }); }); }); END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context }

Target:
public void analyzeBatchSentimentMaxOverloadWithOpinionMining() { List<TextDocumentInput> textDocumentInputs = Arrays.asList( new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.") .setLanguage("en"), new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.") .setLanguage("en") ); AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true) .setIncludeStatistics(true); Response<AnalyzeSentimentResultCollection> response = textAnalyticsClient.analyzeSentimentBatchWithResponse(textDocumentInputs, options, Context.NONE); System.out.printf("Status code of request response: %d%n", response.getStatusCode()); AnalyzeSentimentResultCollection resultCollection = response.getValue(); TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics(); System.out.printf("A batch of documents statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); resultCollection.forEach(analyzeSentimentResult -> { System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); documentSentiment.getSentences().forEach(sentenceSentiment -> { System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment()); sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> { AspectSentiment aspectSentiment = minedOpinions.getAspect(); System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(), aspectSentiment.getText()); for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) { System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n", opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated()); } }); }); }); END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context }