Source:
<code>public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "The food was delicious and there were wonderful staff."), <START> new TextDocumentInput("B", "The pitot tube is used to measure airspeed.") <END> ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true).setModelVersion("latest"); Iterable<TextAnalyticsPagedResponse<ExtractKeyPhraseResult>> keyPhrasesBatchResult = client.extractKeyPhrasesBatch(documents, requestOptions, Context.NONE).iterableByPage(); keyPhrasesBatchResult.forEach(pagedResponse -> { System.out.printf("Results of Azure Text Analytics \"Key Phrases Extraction\" Model, version: %s%n", pagedResponse.getModelVersion()); TextDocumentBatchStatistics batchStatistics = pagedResponse.getStatistics(); System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); AtomicInteger counter = new AtomicInteger(); for (ExtractKeyPhraseResult extractKeyPhraseResult : pagedResponse.getElements()) { System.out.printf("%n%s%n", documents.get(counter.getAndIncrement())); if (extractKeyPhraseResult.isError()) { System.out.printf("Cannot extract key phrases. Error: %s%n", extractKeyPhraseResult.getError().getMessage()); } else { System.out.println("Extracted phrases:"); extractKeyPhraseResult.getKeyPhrases().forEach(keyPhrases -> System.out.printf("\t%s.%n", keyPhrases)); } } }); }</code><technical_language>language</technical_language>

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("A", "The food was delicious and there were wonderful staff.").setLanguage("en"), new TextDocumentInput("B", "The pitot tube is used to measure airspeed.").setLanguage("en") ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true).setModelVersion("latest"); Iterable<TextAnalyticsPagedResponse<ExtractKeyPhraseResult>> keyPhrasesBatchResult = client.extractKeyPhrasesBatch(documents, requestOptions, Context.NONE).iterableByPage(); keyPhrasesBatchResult.forEach(pagedResponse -> { System.out.printf("Results of Azure Text Analytics \"Key Phrases Extraction\" Model, version: %s%n", pagedResponse.getModelVersion()); TextDocumentBatchStatistics batchStatistics = pagedResponse.getStatistics(); System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n", batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); AtomicInteger counter = new AtomicInteger(); for (ExtractKeyPhraseResult extractKeyPhraseResult : pagedResponse.getElements()) { System.out.printf("%n%s%n", documents.get(counter.getAndIncrement())); if (extractKeyPhraseResult.isError()) { System.out.printf("Cannot extract key phrases. Error: %s%n", extractKeyPhraseResult.getError().getMessage()); } else { System.out.println("Extracted phrases:"); extractKeyPhraseResult.getKeyPhrases().forEach(keyPhrases -> System.out.printf("\t%s.%n", keyPhrases)); } } }); }