use of com.graphaware.nlp.dsl.result.NodeResult 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) {
throw new RuntimeException(e);
}
}
use of com.graphaware.nlp.dsl.result.NodeResult 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);
}
}
use of com.graphaware.nlp.dsl.result.NodeResult in project neo4j-nlp by graphaware.
the class EnrichConceptProcedure method annotate.
@Procedure(name = "ga.nlp.enrich.concept", mode = Mode.WRITE)
@Description("Enrich knowledge concepts by consulting external knowledge bases like ConceptNet5 or Microsoft Concept Graphs")
public Stream<NodeResult> annotate(@Name("conceptRequest") Map<String, Object> conceptRequest) {
ConceptRequest request = ConceptRequest.fromMap(conceptRequest);
Enricher enricher = getNLPManager().getEnricher(request.getEnricherName());
Node result = enricher.importConcept(request);
return Stream.of(new NodeResult(result));
}
Aggregations