/** * Get a {@link ResourceManager} with non-default properties. Overloaded to merge the properties * of {@link AnnotatorServiceConfigurator}. * * @param nonDefaultRm The non-default properties * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getConfig(ResourceManager nonDefaultRm) { ResourceManager pipelineRm = super.getConfig(nonDefaultRm); return new AnnotatorServiceConfigurator().getConfig(pipelineRm); } }
/** * The default way to create a {@link TextAnnotation} from pre-tokenized text. * * @param tokenizedSentences A list of sentences, each one being an array of tokens * @return A {@link TextAnnotation} containing the SENTENCE and TOKENS views. */ public static TextAnnotation createTextAnnotationFromTokens(List<String[]> tokenizedSentences) { return createTextAnnotationFromTokens("", "", tokenizedSentences); }
/** * If you want lazy initialization, this method must load the component models/resources, * Default implementation just sets the relevant field to 'true'. */ final public void doInitialize() { initialize(config); isInitialized = true; }
@Override public TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException { return taBuilder.createTextAnnotation(corpusId, docId, text, tokenization); }
public TextAnnotation preProcessText(String text) throws Exception { TextAnnotation ta; if (useCurator) { ta = annotator.createBasicTextAnnotation("", "", text); } else { ta = taBuilder.createTextAnnotation(text); } return preProcessText(ta); }
protected void throwNotCachedException(String corpusId, String docId, String text) throws AnnotatorException { throw new AnnotatorException("text with corpusid '" + corpusId + "', docId '" + docId + "', value '" + text + "' was not in cache, and the field 'throwExceptionIfNotCached' is 'true'."); }
/** * Get a {@link ResourceManager} with non-default properties. Overloaded to merge the properties * of {@link AnnotatorServiceConfigurator}. * * @param nonDefaultRm The non-default properties * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getConfig(ResourceManager nonDefaultRm) { ResourceManager pipelineRm = super.getConfig(nonDefaultRm); return new AnnotatorServiceConfigurator().getConfig(pipelineRm); } }
/** * constructor that uses AnnotatorServiceConfigurator default configuration * * @param textAnnotationBuilder object that will build basic TextAnnotation objects * @param viewProviders annotators that will populate views in new TextAnnotation objects * @throws AnnotatorException */ public BasicAnnotatorService(TextAnnotationBuilder textAnnotationBuilder, Map<String, Annotator> viewProviders) throws AnnotatorException { this(textAnnotationBuilder, viewProviders, (new AnnotatorServiceConfigurator()) .getDefaultConfig()); }
/** * Same lazy view function, but with resource parameters * First, checks whether model is initialized, and calls initialize() if not. Then, calls * addView(). IMPORTANT: clients should always call getView(). */ private void lazyAddView(TextAnnotation ta, ResourceManager runtimeAttributes) throws AnnotatorException { if (!isInitialized()) { doInitialize(); } addView(ta, runtimeAttributes); }
@Override public TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException { return taBuilder.createTextAnnotation(corpusId, docId, text, tokenization); }
public TextAnnotation preProcessText(String text) throws Exception { TextAnnotation ta; if (useCurator) { ta = annotator.createBasicTextAnnotation("", "", text); } else { ta = taBuilder.createTextAnnotation(text); } return preProcessText(ta); }
/** * Get a {@link ResourceManager} with non-default properties. Overloaded to merge the properties * of {@link AnnotatorServiceConfigurator}. * * @param nonDefaultRm The non-default properties * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getConfig(ResourceManager nonDefaultRm) { ResourceManager pipelineRm = super.getConfig(nonDefaultRm); return new AnnotatorServiceConfigurator().getConfig(pipelineRm); } }
/** * The default way to create a {@link TextAnnotation} from pre-tokenized text. * * @param tokenizedSentences A list of sentences, each one being an array of tokens * @return A {@link TextAnnotation} containing the SENTENCE and TOKENS views. */ public static TextAnnotation createTextAnnotationFromTokens(List<String[]> tokenizedSentences) { return createTextAnnotationFromTokens("", "", tokenizedSentences); }
/** * Same lazy view function, but with resource parameters * First, checks whether model is initialized, and calls initialize() if not. Then, calls * addView(). IMPORTANT: clients should always call getView(). */ private void lazyAddView(TextAnnotation ta, ResourceManager runtimeAttributes) throws AnnotatorException { if (!isInitialized()) { doInitialize(); } addView(ta, runtimeAttributes); }
/** * If you want lazy initialization, this method must load the component models/resources, * Default implementation just sets the relevant field to 'true'. */ final public void doInitialize() { initialize(config); isInitialized = true; }
@Override public TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text) throws AnnotatorException { return taBuilder.createTextAnnotation(corpusId, docId, text); }
/** * Get a {@link ResourceManager} with non-default properties. Overloaded to merge the properties * of {@link AnnotatorServiceConfigurator}. * * @param nonDefaultRm The non-default properties * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getConfig(ResourceManager nonDefaultRm) { ResourceManager pipelineRm = super.getConfig(nonDefaultRm); return new AnnotatorServiceConfigurator().getConfig(pipelineRm); } }
/** * First, checks whether model is initialized, and calls initialize() if not. Then, calls * addView(). IMPORTANT: clients should always call getView(). * * @param ta */ private void lazyAddView(TextAnnotation ta) throws AnnotatorException { if (!isInitialized()) { doInitialize(); } addView(ta); }
@Override public TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text) throws AnnotatorException { return taBuilder.createTextAnnotation(corpusId, docId, text); }
/** * Get a {@link ResourceManager} with non-default properties. Overloaded to merge the properties * of {@link AnnotatorServiceConfigurator}. * * @param nonDefaultRm The non-default properties * @return a non-null ResourceManager with appropriate values set. */ @Override public ResourceManager getConfig(ResourceManager nonDefaultRm) { ResourceManager pipelineRm = super.getConfig(nonDefaultRm); return new AnnotatorServiceConfigurator().getConfig(pipelineRm); } }