use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class NLPExtensionIntegrationTest method testExtensionsCanPersistData.
@Test
public void testExtensionsCanPersistData() {
try (Transaction tx = getDatabase().beginTx()) {
getNLPManager().annotateTextAndPersist("Hello world", "id-123", pipelineSpecification);
tx.success();
}
executeInTransaction("MATCH (n:AnnotatedText) RETURN n", (result -> {
assertTrue(result.hasNext());
Node at = (Node) result.next().get("n");
assertTrue(at.hasLabel(Label.label("STUB_Event")));
}));
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class TextProcessorsManager method annotateTags.
public List<Tag> annotateTags(String text, String language) {
PipelineSpecification spec = getDefaultPipeline(language);
TextProcessor processor = getTextProcessor(spec.getTextProcessor());
return processor.annotateTags(text, spec);
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class TextProcessorsManager method setDefaultPipeline.
public void setDefaultPipeline(String pipelineName, String language) {
PipelineSpecification pipelineSpecification = configuration.loadPipeline(pipelineName);
if (null == pipelineSpecification) {
throw new RuntimeException("No pipeline " + pipelineName + " exist");
}
setDefaultPipelineAux(language, pipelineSpecification);
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class TextProcessorsManager method getDefaultPipelineSpecificationFromConfig.
private PipelineSpecification getDefaultPipelineSpecificationFromConfig(String language) {
String pipelineName = (String) configuration.getSettingValueFor(getDefaultPipelineKey(language));
if (pipelineName == null) {
LOG.warn("Something goes wrong (this shouldn't happen) default pipeline not available, key: " + getDefaultPipelineKey(language));
return null;
}
PipelineSpecification pipelineSpecification = configuration.loadPipeline(pipelineName);
if (pipelineSpecification == null) {
LOG.warn("Default pipeline specification for " + pipelineName + " not available");
return null;
}
return pipelineSpecification;
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class WorkflowTextProcessor method init.
@Override
public void init(Map<String, Object> parameters) {
setConfiguration(new WorkflowTextProcessorConfiguration(parameters));
PipelineSpecification pipelineSpecification = NLPManager.getInstance().getTextProcessorsManager().getPipelineSpecification(getConfiguration().getPipeline());
if (null != pipelineSpecification) {
textProcessor = NLPManager.getInstance().getTextProcessorsManager().getTextProcessor(pipelineSpecification.getTextProcessor());
setValid(true);
} else {
LOG.error("Error while initializing the processor. Setting to invalid");
setValid(false);
}
}
Aggregations