Search in sources :

Example 1 with ComputeVectorRequest

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

the class ComputeVectorProcedure method annotate.

@Procedure(name = "ga.nlp.vector.compute", mode = Mode.WRITE)
@Description("Compute vectors for input node and store vector in the property specified")
public Stream<NodeResult> annotate(@Name("computeVectorRequest") Map<String, Object> computeVectorRequest) {
    try {
        ComputeVectorRequest request = ComputeVectorRequest.fromMap(computeVectorRequest);
        Node result = getNLPManager().computeVectorAndPersist(request);
        return Stream.of(new NodeResult(result));
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : NodeResult(com.graphaware.nlp.dsl.result.NodeResult) Node(org.neo4j.graphdb.Node) ComputeVectorRequest(com.graphaware.nlp.dsl.request.ComputeVectorRequest) Description(org.neo4j.procedure.Description) Procedure(org.neo4j.procedure.Procedure)

Aggregations

ComputeVectorRequest (com.graphaware.nlp.dsl.request.ComputeVectorRequest)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