use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class TextRank method initializePipelineWithoutNEs.
private void initializePipelineWithoutNEs() {
// System.out.println(" >>> default processor: " + NLPManager.getInstance().getTextProcessorsManager().getDefaultProcessor().getAlias());
Map<String, Object> params = new HashMap<>();
params.put("tokenize", true);
params.put("ner", false);
PipelineSpecification ps = new PipelineSpecification(PIPELINE_WITHOUT_NER, null);
ps.setProcessingSteps(params);
NLPManager.getInstance().getTextProcessorsManager().getDefaultProcessor().createPipeline(ps);
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class ConceptNet5Importer method getDefaultPipeline.
private PipelineSpecification getDefaultPipeline() {
NLPManager manager = NLPManager.getInstance();
String pipeline = manager.getPipeline(null);
PipelineSpecification pipelineSpecification = manager.getConfiguration().loadPipeline(pipeline);
if (pipelineSpecification == null) {
throw new RuntimeException("No default pipeline");
}
return pipelineSpecification;
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class TextProcessorsProcedure method setDefaultPipeline.
@Procedure(value = "ga.nlp.processor.pipeline.default", mode = Mode.WRITE)
@Description("Specify the pipeline to be used by default")
public Stream<SingleResult> setDefaultPipeline(@Name("name") String name) {
PipelineSpecification pipelineSpecification = getConfiguration().loadPipeline(name);
if (null == pipelineSpecification) {
throw new RuntimeException("Pipeline " + name + " does not exist");
}
getConfiguration().updateInternalSetting(SettingsConstants.DEFAULT_PIPELINE, name);
return Stream.of(SingleResult.success());
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class NLPManager method annotateTextAndPersist.
public Node annotateTextAndPersist(String text, String id, String textProcessor, String pipelineName, boolean force, boolean checkForLanguage) {
String lang = checkTextLanguage(text, checkForLanguage);
String pipeline = getPipeline(pipelineName);
PipelineSpecification pipelineSpecification = getConfiguration().loadPipeline(pipeline);
if (null == pipelineSpecification) {
throw new RuntimeException("No pipeline " + pipelineName + " found.");
}
TextProcessor processor = textProcessorsManager.getTextProcessor(pipelineSpecification.getTextProcessor());
AnnotatedText at = processor.annotateText(text, lang, pipelineSpecification);
return processAnnotationPersist(id, text, at, pipelineSpecification);
}
use of com.graphaware.nlp.dsl.request.PipelineSpecification in project neo4j-nlp by graphaware.
the class NLPManager method setDefaultPipeline.
public void setDefaultPipeline(String pipeline) {
PipelineSpecification pipelineSpecification = configuration.loadPipeline(pipeline);
if (null == pipelineSpecification) {
throw new RuntimeException("No pipeline " + pipeline + " exist");
}
configuration.updateInternalSetting(SettingsConstants.DEFAULT_PIPELINE, pipeline);
}
Aggregations