@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; logger = context.getLogger(); if (logger.isLoggable(Level.INFO)) { logger.log(Level.INFO, "Initializing the " + name + " annotator."); } isRemoveExistingAnnotations = AnnotatorUtil.getOptionalBooleanParameter( context, UimaUtil.IS_REMOVE_EXISTINGS_ANNOTAIONS); if (isRemoveExistingAnnotations == null) { isRemoveExistingAnnotations = false; } }
@Override public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { super.typeSystemInit(typeSystem); sentenceType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.SENTENCE_TYPE_PARAMETER); tokenType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.TOKEN_TYPE_PARAMETER); }
public final void process(AbstractCas aCAS) throws AnalysisEngineProcessException { if (aCAS instanceof CAS) { checkTypeSystemChange((CAS) aCAS); process((CAS) aCAS); } else { throw new AnalysisEngineProcessException( AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { CAS.class, aCAS.getClass() }); } }
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; logger = context.getLogger(); if (logger.isLoggable(Level.INFO)) { logger.log(Level.INFO, "Initializing the OpenNLP Sentence annotator."); } isRemoveExistingAnnotations = AnnotatorUtil.getOptionalBooleanParameter( context, UimaUtil.IS_REMOVE_EXISTINGS_ANNOTAIONS); if (isRemoveExistingAnnotations == null) { isRemoveExistingAnnotations = false; } }
@Override public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { super.typeSystemInit(typeSystem); containerType = AnnotatorUtil.getOptionalTypeParameter(context, typeSystem, "opennlp.uima.ContainerType"); if (containerType == null) { containerType = typeSystem.getType(CAS.TYPE_NAME_DOCUMENT_ANNOTATION); } sentenceType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.SENTENCE_TYPE_PARAMETER); }
public final void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; mLogger = context.getLogger(); if (mLogger.isLoggable(Level.INFO)) { mLogger.log(Level.INFO, "Initializing the " + name + "."); } isRemoveExistingAnnotations = AnnotatorUtil.getOptionalBooleanParameter( context, UimaUtil.IS_REMOVE_EXISTINGS_ANNOTAIONS); if (isRemoveExistingAnnotations == null) { isRemoveExistingAnnotations = false; } initialize(); }
/** * Checks it the type system of the given CAS is different from the last type system this * component was operating on. If it is different, calls the typeSystemInit method on the * component. */ private void checkTypeSystemChange(CAS aCAS) throws AnalysisEngineProcessException { TypeSystem typeSystem = aCAS.getTypeSystem(); if (typeSystem != mLastTypeSystem) { typeSystemInit(typeSystem); mLastTypeSystem = typeSystem; } } }
/** * Initializes the current instance with the given context. * <p> * Note: Do all initialization in this method, do not use the constructor. */ public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; mLogger = context.getLogger(); if (mLogger.isLoggable(Level.INFO)) { mLogger.log(Level.INFO, "Initializing the OpenNLP Normalizer annotator."); } try { String modelName = AnnotatorUtil.getOptionalStringParameter(context, UimaUtil.DICTIONARY_PARAMETER); if (modelName != null) { InputStream inModel = AnnotatorUtil.getResourceAsStream(context, modelName); mLookupDictionary = new StringDictionary(inModel); } } catch (IOException e) { throw new ResourceInitializationException( ExceptionMessages.MESSAGE_CATALOG, "io_error_model_reading", new Object[] {e.getMessage()}, e); } }
@Override public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { super.typeSystemInit(typeSystem); sentenceType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.SENTENCE_TYPE_PARAMETER); tokenType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.TOKEN_TYPE_PARAMETER); }
public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; Logger mLogger = context.getLogger(); if (mLogger.isLoggable(Level.INFO)) { mLogger.log(Level.INFO, "Initializing the OpenNLP Categorizer."); } DoccatModel model; try { DoccatModelResource modelResource = (DoccatModelResource) context .getResourceObject(UimaUtil.MODEL_PARAMETER); model = modelResource.getModel(); } catch (ResourceAccessException e) { throw new ResourceInitializationException(e); } mCategorizer = new DocumentCategorizerME(model); }
@Override public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { super.typeSystemInit(typeSystem); containerType = AnnotatorUtil.getOptionalTypeParameter(context, typeSystem, "opennlp.uima.ContainerType"); if (containerType == null) { containerType = typeSystem.getType(CAS.TYPE_NAME_DOCUMENT_ANNOTATION); } sentenceType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem, UimaUtil.SENTENCE_TYPE_PARAMETER); }
/** * Initializes the current instance with the given context. */ public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; mLogger = context.getLogger(); if (mLogger.isLoggable(Level.INFO)) { mLogger.log(Level.INFO, "Initializing the OpenNLP Parser."); } ParserModel model; try { ParserModelResource modelResource = (ParserModelResource) context .getResourceObject(UimaUtil.MODEL_PARAMETER); model = modelResource.getModel(); } catch (ResourceAccessException e) { throw new ResourceInitializationException(e); } mParser = ParserFactory.create(model); }
public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException { super.typeSystemInit(typeSystem);
/** * Initializes the current instance with the given context. * <p> * Note: Do all initialization in this method, do not use the constructor. */ public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; mLogger = context.getLogger(); if (mLogger.isLoggable(Level.INFO)) { mLogger.log(Level.INFO, "Initializing the OpenNLP Chunker annotator."); } ChunkerModel model; try { ChunkerModelResource modelResource = (ChunkerModelResource) context.getResourceObject(UimaUtil.MODEL_PARAMETER); model = modelResource.getModel(); } catch (ResourceAccessException e) { throw new ResourceInitializationException(e); } mChunker = new ChunkerME(model); }
@Override public void typeSystemInit(TypeSystem ts) throws AnalysisEngineProcessException { super.typeSystemInit(ts); String idTypeName = (String) getContext().getConfigParameterValue("IdFSTypeName"); idType = ts.getType(idTypeName); String idFeatureName = (String) getContext().getConfigParameterValue("IdFeatureName"); idFeature = idType.getFeatureByBaseName(idFeatureName); }
/** * Initializes the current instance with the given context. * <p> * Note: Do all initialization in this method, do not use the constructor. */ @Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); this.context = context; this.logger = context.getLogger(); if (this.logger.isLoggable(Level.INFO)) { this.logger.log(Level.INFO, "Initializing the OpenNLP " + "Part of Speech annotator."); } POSModel model; try { POSModelResource modelResource = (POSModelResource) context .getResourceObject(UimaUtil.MODEL_PARAMETER); model = modelResource.getModel(); } catch (ResourceAccessException e) { throw new ResourceInitializationException(e); } Integer beamSize = AnnotatorUtil.getOptionalIntegerParameter(context, UimaUtil.BEAM_SIZE_PARAMETER); if (beamSize == null) { beamSize = POSTaggerME.DEFAULT_BEAM_SIZE; } this.posTagger = new POSTaggerME(model); }
@Override public void initialize(UimaContext uimaContext) throws ResourceInitializationException { super.initialize(uimaContext); try { int aeSleepSeconds = 2; Thread.sleep(aeSleepSeconds*1000); } catch(Exception e) { } return; }
@Override public void initialize(UimaContext uimaContext) throws ResourceInitializationException { super.initialize(uimaContext); try { int aeSleepSeconds = 2; Thread.sleep(aeSleepSeconds*1000); } catch(Exception e) { } return; }
@Override public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); documentName = ((String) aContext.getConfigParameterValue("documentName")); }
@Override public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); documentName = ((String) aContext.getConfigParameterValue("documentName")); }