use of com.graphaware.nlp.dsl.request.ConceptRequest in project neo4j-nlp by graphaware.
the class ConceptRequestUnitTest method testRequestWithLimitLongCanBeCaster.
@Test
public void testRequestWithLimitLongCanBeCaster() {
Map<String, Object> map = new HashMap<>();
map.put("tag", new NodeProxy());
map.put("admittedRelationships", Arrays.asList("IsA", "PartOf"));
map.put("admittedPos", Arrays.asList("NNS", "NN"));
map.put("language", "en");
map.put("splitTag", true);
map.put("limit", 50L);
ConceptRequest request = ConceptRequest.fromMap(map);
assertEquals(50, request.getResultsLimit());
}
use of com.graphaware.nlp.dsl.request.ConceptRequest in project neo4j-nlp by graphaware.
the class ConceptRequestUnitTest method testConceptRequestFromMap.
@Test
public void testConceptRequestFromMap() {
Map<String, Object> map = new HashMap<>();
map.put("tag", new NodeProxy());
map.put("admittedRelationships", Arrays.asList("IsA", "PartOf"));
map.put("admittedPos", Arrays.asList("NNS", "NN"));
map.put("splitTag", true);
map.put("relDirection", "out");
ConceptRequest request = ConceptRequest.fromMap(map);
assertEquals(2, request.getAdmittedRelationships().size());
assertTrue(request.getAdmittedRelationships().contains("IsA"));
assertEquals(2, request.getAdmittedPos().size());
assertEquals("out", request.getRelDirection());
}
use of com.graphaware.nlp.dsl.request.ConceptRequest 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