Skip to content

Files

natural-language-understanding

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 5, 2024
Dec 5, 2024
May 6, 2021

Natural Language Understanding

Installation

Maven
<dependency>
  <groupId>com.ibm.watson</groupId>
  <artifactId>natural-language-understanding</artifactId>
  <version>14.0.0</version>
</dependency>
Gradle
'com.ibm.watson:natural-language-understanding:14.0.0'

Usage

Use Natural Language Understanding to analyze various features of text content at scale. Provide text, raw HTML, or a public URL, and IBM Watson Natural Language Understanding will give you results for the features you request. The service cleans HTML content before analysis by default, so the results can ignore most advertisements and other unwanted content.

Authenticator authenticator = new IamAuthenticator("<iam_api_key>");
NaturalLanguageUnderstanding service = new NaturalLanguageUnderstanding("2019-07-12", authenticator);

EntitiesOptions entities = new EntitiesOptions.Builder()
  .sentiment(true)
  .limit(1L)
  .build();
Features features = new Features.Builder()
  .entities(entities)
  .build();
AnalyzeOptions parameters = new AnalyzeOptions.Builder()
  .url("www.cnn.com")
  .features(features)
  .build();

AnalysisResults results = service.analyze(parameters).execute().getResult();
System.out.println(results);