Last active
September 28, 2017 23:10
-
-
Save jzonthemtn/f73730a33557f8d547f87c05e1be6cca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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