use of com.graphaware.nlp.dsl.result.SingleResult in project neo4j-nlp by graphaware.
the class AnnotateProcedure method filter.
@Procedure(name = "ga.nlp.filter", mode = Mode.WRITE)
@Description("Boolean filter for text accordingly to complex filter definition")
public Stream<SingleResult> filter(@Name("filterRequest") Map<String, Object> filterRequest) {
FilterRequest request = FilterRequest.fromMap(filterRequest);
Object result = getNLPManager().filter(request);
return Stream.of(new SingleResult(result));
}
use of com.graphaware.nlp.dsl.result.SingleResult in project neo4j-nlp by graphaware.
the class TextProcessorsProcedure method test.
@Procedure(name = "ga.nlp.processor.test", mode = Mode.WRITE)
@Description("Procedure for testing custom models.")
public Stream<SingleResult> test(@Name("customModelsRequest") Map<String, Object> customModelsRequest) {
try {
CustomModelsRequest request = CustomModelsRequest.fromMap(customModelsRequest);
Object result = getNLPManager().test(request);
return Stream.of(new SingleResult(result));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.graphaware.nlp.dsl.result.SingleResult in project neo4j-nlp by graphaware.
the class Word2VecProcedure method attachConcepts.
@Procedure(name = "ga.nlp.ml.word2vec.attach", mode = Mode.WRITE)
@Description("For each tag attach the related word2vec value")
public Stream<SingleResult> attachConcepts(@Name("input") Map<String, Object> word2VecRequest) {
Word2VecRequest request = Word2VecRequest.fromMap(word2VecRequest);
Word2VecProcessor word2VecProcessor = (Word2VecProcessor) getNLPManager().getExtension(Word2VecProcessor.class);
int processed = word2VecProcessor.attach(request);
return Stream.of(new SingleResult(processed));
}
use of com.graphaware.nlp.dsl.result.SingleResult 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> similarityOld(@Name("input") List<Node> input,
// @Name("depth") Long depth,
// @Name("query") String query,
// @Name("relationshipType") String relationshipType) {
// SimilarityProcessor similarityProcessor = (SimilarityProcessor) getNLPManager().getExtension(SimilarityProcessor.class);
// int processed = similarityProcessor.compute(input, query, relationshipType, depth);
// return Stream.of(new SingleResult(processed));
// }
@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);
}
}
use of com.graphaware.nlp.dsl.result.SingleResult in project neo4j-nlp by graphaware.
the class TextProcessorsProcedure method train.
@Procedure(name = "ga.nlp.processor.train", mode = Mode.WRITE)
@Description("Procedure for training custom models.")
public Stream<SingleResult> train(@Name("customModelsRequest") Map<String, Object> customModelsRequest) {
try {
CustomModelsRequest request = CustomModelsRequest.fromMap(customModelsRequest);
Object result = getNLPManager().train(request);
return Stream.of(new SingleResult(result));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations