static private String getName( final String elementName, final Element element ) throws AnnotatorContextException { final String name = element.getChildText( NAME_KEY ); if ( name == null || name.isEmpty() ) { throw new AnnotatorContextException( "Missing name for " + elementName, EMPTY_OBJECT_ARRAY ); } return name; }
/** * Performs initialization logic. This implementation just reads values for * the configuration parameters. This method is not invoked for every * document processed. * * @see com.ibm.uima.analysis_engine.annotator.BaseAnnotator#initialize(UimaContext) */ public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); context = aContext; try { configInit(); } catch (AnnotatorContextException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * Performs initialization logic. This implementation just reads values for * the configuration parameters. This method is not invoked for every * document processed. * * @see com.ibm.uima.analysis_engine.annotator.BaseAnnotator#initialize(UimaContext) */ public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); context = aContext; try { configInit(); } catch (AnnotatorContextException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public String getResourceFilePath(String aKey) throws AnnotatorContextException { try { return mUimaContext.getResourceFilePath(aKey); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
/** * Initialisiation of UIMA-JNET. Reads in and checks descriptor's parameters. * * @throws ResourceInitializationException */ @Override public void initialize(final UimaContext aContext) throws ResourceInitializationException { LOGGER.info("initialize() - initializing JPOS..."); // invoke default initialization super.initialize(aContext); // get modelfilename from parameters try { // compulsory params setModel(aContext); postagset = (String) aContext.getConfigParameterValue("tagset"); } catch (final AnnotatorContextException e) { e.printStackTrace(); throw new ResourceInitializationException(); } catch (final AnnotatorConfigurationException e) { e.printStackTrace(); throw new ResourceInitializationException(); } catch (final AnnotatorInitializationException e) { e.printStackTrace(); throw new ResourceInitializationException(); } }
/** * Acquires a Resource object using the ResourceManager. * * @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceObject(String) */ public Object getResourceObject(String aKey) throws AnnotatorContextException { try { return mUimaContext.getResourceObject(aKey); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
/** * Invokes this annotator's analysis logic. Invoked for each document * processed. */ public void process(JCas jcas) throws AnalysisEngineProcessException { String text = jcas.getDocumentText(); try { // just one sentence iv_logger.info(" jcas "+ jcas.getViewName()); if (!useSegments) { // annotate over full doc text annotateRange(jcas, text, 0, text.length()); } else { JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> segmentItr = indexes.getAnnotationIndex( Segment.type).iterator(); while (segmentItr.hasNext()) { Segment segmentAnnotation = (Segment) segmentItr.next(); String segmentID = segmentAnnotation.getId(); if (!skipSegmentsSet.contains(segmentID)) { int start = segmentAnnotation.getBegin(); int end = segmentAnnotation.getEnd(); annotateRange(jcas, text, start, end); } } } } catch (AnnotatorContextException e) { e.printStackTrace(); } }
/** * @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceObject(java.lang.String, * java.lang.String[]) */ public Object getResourceObject(String aKey, String[] aParams) throws AnnotatorContextException { try { return mUimaContext.getResourceObject(aKey, aParams); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
/** * Invokes this annotator's analysis logic. Invoked for each document * processed. */ public void process(JCas jcas) throws AnalysisEngineProcessException { String text = jcas.getDocumentText(); try { // just one sentence iv_logger.info(" jcas "+ jcas.getViewName()); if (!useSegments) { // annotate over full doc text annotateRange(jcas, text, 0, text.length()); } else { JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> segmentItr = indexes.getAnnotationIndex( Segment.type).iterator(); while (segmentItr.hasNext()) { Segment segmentAnnotation = (Segment) segmentItr.next(); String segmentID = segmentAnnotation.getId(); if (!skipSegmentsSet.contains(segmentID)) { int start = segmentAnnotation.getBegin(); int end = segmentAnnotation.getEnd(); annotateRange(jcas, text, start, end); } } } } catch (AnnotatorContextException e) { e.printStackTrace(); } }
static private String getName( final String elementName, final Element element ) throws AnnotatorContextException { final String name = element.getChildText( NAME_KEY ); if ( name == null || name.isEmpty() ) { throw new AnnotatorContextException( "Missing name for " + elementName, EMPTY_OBJECT_ARRAY ); } return name; }
/** * @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceURL(java.lang.String, * java.lang.String[]) */ public URL getResourceURL(String aKey, String[] aParams) throws AnnotatorContextException { try { return mUimaContext.getResourceURL(aKey, aParams); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
public URI getResourceURI(String aKey) throws AnnotatorContextException { try { return mUimaContext.getResourceURI(aKey); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
/** * Locates Resource URL's using the ResourceManager, or, if that fails, the ClassLoader. * * @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceURL(String) */ public URL getResourceURL(String aKey) throws AnnotatorContextException { try { return mUimaContext.getResourceURL(aKey); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
/** * @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceAsStream(java.lang.String, * java.lang.String[]) */ public InputStream getResourceAsStream(String aKey, String[] aParams) throws AnnotatorContextException { try { return mUimaContext.getResourceAsStream(aKey, aParams); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
public URI getResourceURI(String aKey, String[] aParams) throws AnnotatorContextException { try { return mUimaContext.getResourceURI(aKey, aParams); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
public String getResourceFilePath(String aKey, String[] aParams) throws AnnotatorContextException { try { return mUimaContext.getResourceFilePath(aKey, aParams); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
/** * Acquires Resource InputStreams using the ResourceManager, or, if that fails, the ClassLoader. * * @see org.apache.uima.analysis_engine.annotator.AnnotatorContext#getResourceAsStream(String) */ public InputStream getResourceAsStream(String aKey) throws AnnotatorContextException { try { return mUimaContext.getResourceAsStream(aKey); } catch (ResourceAccessException e) { throw new AnnotatorContextException(e); } }
consumerClass = Class.forName( consumerClassName ); } catch ( ClassNotFoundException cnfE ) { throw new AnnotatorContextException( "Unknown class " + consumerClassName, EMPTY_OBJECT_ARRAY, cnfE ); throw new AnnotatorContextException( consumerClassName + " is not a TermConsumer", EMPTY_OBJECT_ARRAY ); throw new AnnotatorContextException( "Could not construct " + consumerClassName, EMPTY_OBJECT_ARRAY, multE ); throw new AnnotatorContextException( "No Constructor for " + consumerClassName, EMPTY_OBJECT_ARRAY );
dictionaryClass = Class.forName( className ); } catch ( ClassNotFoundException cnfE ) { throw new AnnotatorContextException( "Unknown class " + className, EMPTY_OBJECT_ARRAY, cnfE ); throw new AnnotatorContextException( className + " is not a Rare Word Dictionary", EMPTY_OBJECT_ARRAY ); throw new AnnotatorContextException( "Could not construct " + className, EMPTY_OBJECT_ARRAY, iniaitE ); throw new AnnotatorContextException( "No Constructor for " + className, EMPTY_OBJECT_ARRAY );
consumerClass = Class.forName( consumerClassName ); } catch ( ClassNotFoundException cnfE ) { throw new AnnotatorContextException( "Unknown class " + consumerClassName, EMPTY_OBJECT_ARRAY, cnfE ); throw new AnnotatorContextException( consumerClassName + " is not a TermConsumer", EMPTY_OBJECT_ARRAY ); throw new AnnotatorContextException( "Could not construct " + consumerClassName, EMPTY_OBJECT_ARRAY, multE ); throw new AnnotatorContextException( "No Constructor for " + consumerClassName, EMPTY_OBJECT_ARRAY );