use of com.graphaware.nlp.dsl.request.SimilarityRequest in project neo4j-nlp by graphaware.
the class SimilarityProcedure method similarity.
@Procedure(name = "ga.nlp.ml.similarity.cosine", mode = Mode.WRITE)
@Description("Compute similarity between Annotated Text")
public Stream<SingleResult> similarity(@Name("similarityRequest") Map<String, Object> similarityRequest) {
try {
SimilarityRequest request = SimilarityRequest.fromMap(similarityRequest);
SimilarityProcessor similarityProcessor = (SimilarityProcessor) getNLPManager().getExtension(SimilarityProcessor.class);
int processed = similarityProcessor.compute(request);
return Stream.of(new SingleResult(processed));
} catch (Exception ex) {
LOG.error("Error while computing similarity", ex);
throw new RuntimeException(ex);
}
}
Aggregations