Instantly share code, notes, and snippets.

Embed
What would you like to do?
<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