ResourceManager fullRm = (new PipelineConfigurator()).getConfig(new Stanford331Configurator().getConfig(nonDefaultValues)); boolean splitOnHypen = fullRm.getBoolean(PipelineConfigurator.SPLIT_ON_DASH.key);
ResourceManager fullRm = (new PipelineConfigurator()).getConfig(new Stanford331Configurator().getConfig(nonDefaultValues)); boolean splitOnHypen = fullRm.getBoolean(PipelineConfigurator.SPLIT_ON_DASH.key);
ResourceManager rm = new PipelineConfigurator().getConfig(new Stanford331Configurator().getConfig(nonDefaultRm)); String timePerSentence = rm.getString(Stanford331Configurator.STFRD_TIME_PER_SENTENCE); String maxParseSentenceLength =
ResourceManager rm = new PipelineConfigurator().getConfig(new Stanford331Configurator().getConfig(nonDefaultRm)); String timePerSentence = rm.getString(Stanford331Configurator.STFRD_TIME_PER_SENTENCE); String maxParseSentenceLength =
/** * create an AnnotatorService with components specified by the ResourceManager (to override * defaults in {@link PipelineConfigurator} * * @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 PipelineConfigurator()).getConfig(new Stanford331Configurator().getConfig(rm)); Boolean splitOnDash = fullRm.getBoolean(PipelineConfigurator.SPLIT_ON_DASH); boolean isSentencePipeline = fullRm.getBoolean(PipelineConfigurator.USE_SENTENCE_PIPELINE.key); if (isSentencePipeline) { // update cache directory to be distinct from regular pipeline String cacheDir = fullRm.getString(AnnotatorServiceConfigurator.CACHE_DIR.key); cacheDir += "_sentence"; Properties props = fullRm.getProperties(); props.setProperty(AnnotatorServiceConfigurator.CACHE_DIR.key, cacheDir); fullRm = new ResourceManager(props); } TextAnnotationBuilder taBldr = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnDash, false)); Map<String, Annotator> annotators = buildAnnotators(fullRm); return isSentencePipeline ? new SentencePipeline(taBldr, annotators, fullRm) : new BasicAnnotatorService(taBldr, annotators, fullRm); }
/** * create an AnnotatorService with components specified by the ResourceManager (to override * defaults in {@link PipelineConfigurator} * * @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 PipelineConfigurator()).getConfig(new Stanford331Configurator().getConfig(rm)); Boolean splitOnDash = fullRm.getBoolean(PipelineConfigurator.SPLIT_ON_DASH); boolean isSentencePipeline = fullRm.getBoolean(PipelineConfigurator.USE_SENTENCE_PIPELINE.key); if (isSentencePipeline) { // update cache directory to be distinct from regular pipeline String cacheDir = fullRm.getString(AnnotatorServiceConfigurator.CACHE_DIR.key); cacheDir += "_sentence"; Properties props = fullRm.getProperties(); props.setProperty(AnnotatorServiceConfigurator.CACHE_DIR.key, cacheDir); fullRm = new ResourceManager(props); } TextAnnotationBuilder taBldr = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnDash, false)); Map<String, Annotator> annotators = buildAnnotators(fullRm); return isSentencePipeline ? new SentencePipeline(taBldr, annotators, fullRm) : new BasicAnnotatorService(taBldr, annotators, fullRm); }