static void checkLength(TextAnnotation textAnnotation, boolean throwExceptionOnSentenceLengthCheck, int maxParseSentenceLength) throws AnnotatorException { if (throwExceptionOnSentenceLengthCheck) { Constituent c = HandlerUtils.checkTextAnnotationRespectsSentenceLengthLimit(textAnnotation, maxParseSentenceLength); if (null != c) { String msg = HandlerUtils.getSentenceLengthError(textAnnotation.getId(), c.getSurfaceForm(), maxParseSentenceLength); logger.error(msg); throw new AnnotatorException(msg); } } }
/** * get a ResourceManager object with the default key/value pairs for this configurator * default SRL_TYPE is Verb. * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getDefaultConfig() { Property[] properties = {STFRD_TIME_PER_SENTENCE, STFRD_MAX_SENTENCE_LENGTH, THROW_EXCEPTION_ON_FAILED_LENGTH_CHECK}; return (new AnnotatorServiceConfigurator().getConfig(new ResourceManager( generateProperties(properties)))); }
/** * get a ResourceManager object with the default key/value pairs for this configurator default * SRL_TYPE is Verb. * * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getDefaultConfig() { Property[] properties = {USE_JSON, USE_LAZY_INITIALIZATION, USE_SRL_INTERNAL_PREPROCESSOR, SPLIT_ON_DASH, USE_SENTENCE_PIPELINE}; return (new AnnotatorServiceConfigurator().getConfig(new ResourceManager( generateProperties(properties)))); }
/** * 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); }
annotatorService = CuratorFactory.buildCuratorClient(curatorConfig); } else { ResourceManager rm = new Stanford331Configurator().getDefaultConfig(); String timePerSentence = Stanford331Configurator.STFRD_TIME_PER_SENTENCE.value; String maxParseSentenceLength = Stanford331Configurator.STFRD_MAX_SENTENCE_LENGTH.value;
/** * 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, Map<String, Annotator> annotators) 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, false)); return new BasicAnnotatorService(taBldr, annotators, fullRm); } }
/** * get a ResourceManager object with the default key/value pairs for this configurator default * SRL_TYPE is Verb. * * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getDefaultConfig() { Property[] properties = {USE_POS, USE_LEMMA, USE_SHALLOW_PARSE, USE_DEP, USE_NER_CONLL, USE_NER_ONTONOTES, USE_STANFORD_PARSE, USE_STANFORD_DEP, USE_SRL_VERB, USE_SRL_NOM, USE_SRL_PREP, USE_SRL_COMMA, USE_QUANTIFIER, USE_VERB_SENSE, USE_JSON, USE_RELATION, USE_LAZY_INITIALIZATION, USE_SRL_INTERNAL_PREPROCESSOR, SPLIT_ON_DASH, USE_SENTENCE_PIPELINE, USE_TIMEX3, USE_MENTION, USE_TRANSLITERATION, USE_DATALESS_ESA, USE_DATALESS_W2V, USE_QUESTION_TYPER}; return (new AnnotatorServiceConfigurator().getConfig(new ResourceManager( generateProperties(properties)))); }
CoreMap sentence = sentences.get(sentenceId); if (maxParseSentenceLength > 0 && sentence.size() > maxParseSentenceLength) { logger.warn(HandlerUtils.getSentenceLengthError(textAnnotation.getId(), sentence.toString(), maxParseSentenceLength)); } else {
/** * 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); }
annotatorService = CuratorFactory.buildCuratorClient(curatorConfig); } else { ResourceManager rm = new Stanford331Configurator().getDefaultConfig(); String timePerSentence = Stanford331Configurator.STFRD_TIME_PER_SENTENCE.value; String maxParseSentenceLength = Stanford331Configurator.STFRD_MAX_SENTENCE_LENGTH.value;
static void checkLength(TextAnnotation textAnnotation, boolean throwExceptionOnSentenceLengthCheck, int maxParseSentenceLength) throws AnnotatorException { if (throwExceptionOnSentenceLengthCheck) { Constituent c = HandlerUtils.checkTextAnnotationRespectsSentenceLengthLimit(textAnnotation, maxParseSentenceLength); if (null != c) { String msg = HandlerUtils.getSentenceLengthError(textAnnotation.getId(), c.getSurfaceForm(), maxParseSentenceLength); logger.error(msg); throw new AnnotatorException(msg); } } }
/** * 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, Map<String, Annotator> annotators) 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, false)); return new BasicAnnotatorService(taBldr, annotators, fullRm); } }
/** * get a ResourceManager object with the default key/value pairs for this configurator * default SRL_TYPE is Verb. * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getDefaultConfig() { Property[] properties = {STFRD_TIME_PER_SENTENCE, STFRD_MAX_SENTENCE_LENGTH, THROW_EXCEPTION_ON_FAILED_LENGTH_CHECK}; return (new AnnotatorServiceConfigurator().getConfig(new ResourceManager( generateProperties(properties)))); }
/** * get a ResourceManager object with the default key/value pairs for this configurator default * SRL_TYPE is Verb. * * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getDefaultConfig() { Property[] properties = {USE_JSON, USE_LAZY_INITIALIZATION, USE_SRL_INTERNAL_PREPROCESSOR, SPLIT_ON_DASH, USE_SENTENCE_PIPELINE}; return (new AnnotatorServiceConfigurator().getConfig(new ResourceManager( generateProperties(properties)))); }
/** * get a ResourceManager object with the default key/value pairs for this configurator default * SRL_TYPE is Verb. * * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getDefaultConfig() { Property[] properties = {USE_POS, USE_LEMMA, USE_SHALLOW_PARSE, USE_DEP, USE_NER_CONLL, USE_NER_ONTONOTES, USE_STANFORD_PARSE, USE_STANFORD_DEP, USE_SRL_VERB, USE_SRL_NOM, USE_SRL_PREP, USE_SRL_COMMA, USE_QUANTIFIER, USE_VERB_SENSE, USE_JSON, USE_RELATION, USE_LAZY_INITIALIZATION, USE_SRL_INTERNAL_PREPROCESSOR, SPLIT_ON_DASH, USE_SENTENCE_PIPELINE, USE_TIMEX3, USE_MENTION, USE_TRANSLITERATION, USE_DATALESS_ESA, USE_DATALESS_W2V, USE_QUESTION_TYPER}; return (new AnnotatorServiceConfigurator().getConfig(new ResourceManager( generateProperties(properties)))); }
CoreMap sentence = sentences.get(sentenceId); if (maxParseSentenceLength > 0 && sentence.size() > maxParseSentenceLength) { logger.warn(HandlerUtils.getSentenceLengthError(textAnnotation.getId(), sentence.toString(), maxParseSentenceLength)); } else {
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 =