Skip to content

Instantly share code, notes, and snippets.

@jzonthemtn
Last active September 28, 2017 23:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jzonthemtn/f73730a33557f8d547f87c05e1be6cca to your computer and use it in GitHub Desktop.
<dependency>
<groupId>com.mtnfog</groupId>
<artifactId>idyl-e3-java-sdk</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.yahoo.vespa</groupId>
<artifactId>annotations</artifactId>
<version>6.149.44</version>
</dependency>
String text = "George Washington was president.";
IdylE3Client idylE3Client = IdylE3ClientFactory.getIdylE3Client("http://localhost:9000/");
EntityExtractionResponse response = idylE3Client.extract(text);
AnnotationTypeRegistry atr = processing.getService().getDocumentTypeManager().getAnnotationTypeRegistry();
AnnotationType person = atr.getType("markup");
SpanList root = new SpanList();
SpanTree tree = new SpanTree(name, root);
for(Entity entity : response.getEntities()) {
Span span = new Span(entity.getSpan().getCharacterStart(), entity.getText().length());
root.add(span);
tree.annotate(span, person);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment