Search in sources :

Example 1 with Enricher

use of com.graphaware.nlp.enrich.Enricher 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));
}
Also used : NodeResult(com.graphaware.nlp.dsl.result.NodeResult) Node(org.neo4j.graphdb.Node) ConceptRequest(com.graphaware.nlp.dsl.request.ConceptRequest) Enricher(com.graphaware.nlp.enrich.Enricher) Description(org.neo4j.procedure.Description) Procedure(org.neo4j.procedure.Procedure)

Example 2 with Enricher

use of com.graphaware.nlp.enrich.Enricher in project neo4j-nlp by graphaware.

the class EnrichConceptProcedure method list.

@Procedure(name = "ga.nlp.enrichers.list", mode = Mode.READ)
@Description("List enrichers available")
public Stream<EnricherList> list() {
    Map<String, Enricher> enrichers = getNLPManager().getEnrichmentRegistry().getEnrichers();
    List<EnricherList> list = new ArrayList<>();
    enrichers.values().forEach(e -> {
        list.add(new EnricherList(e.getName(), e.getAlias()));
    });
    return list.stream();
}
Also used : ArrayList(java.util.ArrayList) EnricherList(com.graphaware.nlp.dsl.result.EnricherList) Enricher(com.graphaware.nlp.enrich.Enricher) Description(org.neo4j.procedure.Description) Procedure(org.neo4j.procedure.Procedure)

Aggregations

Enricher (com.graphaware.nlp.enrich.Enricher)2 Description (org.neo4j.procedure.Description)2 Procedure (org.neo4j.procedure.Procedure)2 ConceptRequest (com.graphaware.nlp.dsl.request.ConceptRequest)1 EnricherList (com.graphaware.nlp.dsl.result.EnricherList)1 NodeResult (com.graphaware.nlp.dsl.result.NodeResult)1 ArrayList (java.util.ArrayList)1 Node (org.neo4j.graphdb.Node)1