use of com.graphaware.nlp.exception.InvalidTextProcessorException in project neo4j-nlp by graphaware.
the class TextProcessorsManager method retrieveTextProcessor.
public TextProcessor retrieveTextProcessor(String processor, String pipeline) {
TextProcessor newTP;
if (processor != null && processor.length() > 0) {
newTP = getTextProcessor(processor);
if (newTP == null) {
throw new InvalidTextProcessorException("Text processor " + processor + " doesn't exist");
}
} else {
newTP = getDefaultProcessor();
}
if (pipeline != null && pipeline.length() > 0) {
if (!newTP.checkPipeline(pipeline)) {
throw new RuntimeException("Pipeline with name " + pipeline + " doesn't exist for processor " + newTP.getClass().getName());
}
} else {
throw new InvalidPipelineException("Pipeline not specified");
}
LOG.info("Using text processor: " + newTP.getClass().getName());
return newTP;
}
Aggregations