Search in sources :

Example 1 with AnnotationRequest

use of com.graphaware.nlp.dsl.request.AnnotationRequest in project neo4j-nlp by graphaware.

the class AnnotateProcedure method annotate.

@Procedure(name = "ga.nlp.annotate", mode = Mode.WRITE)
@Description("Performs the text annotation and store it into the graph")
public Stream<NodeResult> annotate(@Name("annotationRequest") Map<String, Object> annotationRequest) {
    try {
        AnnotationRequest request = AnnotationRequest.fromMap(annotationRequest);
        Node result = getNLPManager().annotateTextAndPersist(request);
        return Stream.of(new NodeResult(result));
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : AnnotationRequest(com.graphaware.nlp.dsl.request.AnnotationRequest) NodeResult(com.graphaware.nlp.dsl.result.NodeResult) Node(org.neo4j.graphdb.Node) Description(org.neo4j.procedure.Description) Procedure(org.neo4j.procedure.Procedure)

Aggregations

AnnotationRequest (com.graphaware.nlp.dsl.request.AnnotationRequest)1 NodeResult (com.graphaware.nlp.dsl.result.NodeResult)1 Node (org.neo4j.graphdb.Node)1 Description (org.neo4j.procedure.Description)1 Procedure (org.neo4j.procedure.Procedure)1