This is the Java client library for AYLIEN's APIs. If you haven't already done so, you will need to sign up.
Add this dependency to your project's POM:
<dependency>
<groupId>com.aylien.textapi</groupId>
<artifactId>client</artifactId>
<version>0.3.0</version>
</dependency>
Add this to your libraryDependencies
:
"com.aylien.textapi" % "client" % "0.3.0"
See the Developers Guide for additional documentation.
import com.aylien.textapi.TextAPIClient;
import com.aylien.textapi.parameters.*;
import com.aylien.textapi.responses.*;
import java.net.URL;
class Example {
public static void main(String[] args) throws Exception {
TextAPIClient client = new TextAPIClient("YourApplicationId", "YourApplicationKey");
ConceptsParams.Builder builder = ConceptsParams.newBuilder();
builder.setUrl(new URL("http://www.bbc.com/news/science-environment-30097648"));
Concepts concepts = client.concepts(builder.build());
System.out.println(concepts.getText());
for (Concept c: concepts.getConcepts()) {
System.out.println(c.getUri());
for (SurfaceForm sf: c.getSurfaceForms()) {
System.out.println(sf.getString());
}
}
}
}