use of edu.illinois.cs.cogcomp.pipeline.common.ExternalToolsConfigurator in project cogcomp-nlp by CogComp.
the class ExternalAnnotatorServiceFactory method buildPipeline.
/**
* create an AnnotatorService with components specified by the ResourceManager (to override
* defaults in {@link ExternalToolsConfigurator}
*
* @param rm non-default config options
* @return AnnotatorService with specified NLP components
* @throws IOException
* @throws AnnotatorException
*/
public static BasicAnnotatorService buildPipeline(ResourceManager rm) throws IOException, AnnotatorException {
// Merges default configuration with the user-specified overrides.
ResourceManager fullRm = (new ExternalToolsConfigurator()).getConfig(rm);
Boolean splitOnDash = fullRm.getBoolean(ExternalToolsConfigurator.SPLIT_ON_DASH);
boolean isSentencePipeline = fullRm.getBoolean(ExternalToolsConfigurator.USE_SENTENCE_PIPELINE.key);
TextAnnotationBuilder taBldr = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnDash));
Map<String, Annotator> annotators = buildAnnotators();
return isSentencePipeline ? new SentencePipeline(taBldr, annotators, fullRm) : new BasicAnnotatorService(taBldr, annotators, fullRm);
}
Aggregations