public class PersonTitleAnnotator extends CasAnnotator_ImplBase
CivilianTitles
, MilitaryTitles
, and
GovernmentTitles
configuration parameters.
If the ContainingAnnotationType
parameter is specified, this annotator will only
look for titles within existing annotations of that type. This feature can be used, for example,
to only match person titles within existing Person Name annotations, discovered by some annotator
that has run previously.
Constructor and Description |
---|
PersonTitleAnnotator() |
Modifier and Type | Method and Description |
---|---|
protected void |
annotateRange(CAS aCAS,
String aText,
int aBeginPos)
A utility method that searches a part of the document for Person Titles.
|
protected void |
annotateRange(CAS aCAS,
String aText,
int aBeginPos,
String aTitleType,
String[] aTitles)
A utility method that searches a part of the document for a specific kind of Person Title.
|
protected void |
createAnnotation(CAS aCAS,
int aBeginPos,
int aEndPos,
String aTitleType)
Creates an PersonTitle annotation in the CAS.
|
void |
initialize(UimaContext aContext)
Performs initialization logic.
|
void |
process(CAS aCAS)
Annotates a document.
|
void |
typeSystemInit(TypeSystem aTypeSystem)
Called whenever the CAS type system changes.
|
getRequiredCasInterface, process
getCasInstancesRequired, hasNext, next
batchProcessComplete, collectionProcessComplete, destroy, getContext, getResultSpecification, reconfigure, setResultSpecification
public void initialize(UimaContext aContext) throws ResourceInitializationException
initialize
in interface AnalysisComponent
initialize
in class AnalysisComponent_ImplBase
aContext
- Provides access to services and resources managed by the framework. This includes
configuration parameters, logging, and access to external resources.ResourceInitializationException
- if this AnalysisComponent cannot initialize successfully.BaseAnnotator.initialize(AnnotatorContext)
public void typeSystemInit(TypeSystem aTypeSystem) throws AnalysisEngineProcessException
typeSystemInit
in class CasAnnotator_ImplBase
aTypeSystem
- the new type system to use as input to your initializationAnalysisEngineProcessException
- if the provided type system is missing types or features required by this annotatorBaseAnnotator.typeSystemInit(TypeSystem)
public void process(CAS aCAS) throws AnalysisEngineProcessException
process
in class CasAnnotator_ImplBase
aCAS
- CAS containing document text and previously discovered annotations, and to which new
annotations are to be written.AnalysisEngineProcessException
- if a problem occurs during processingCasAnnotator_ImplBase.process(CAS)
protected void annotateRange(CAS aCAS, String aText, int aBeginPos)
aCAS
- the CAS in which to create new annotationsaText
- the substring of the document text within which to searchaBeginPos
- the position of this substring relative to the start of the documentprotected void annotateRange(CAS aCAS, String aText, int aBeginPos, String aTitleType, String[] aTitles)
aCAS
- the CAS in which to create new annotationsaText
- the substring of the document text within which to searchaBeginPos
- the position of this substring relative to the start of the documentaTitleType
- the type of title to look for. This becomes the value of the Kind
feature.aTitles
- the exact strings to look for in the documentprotected void createAnnotation(CAS aCAS, int aBeginPos, int aEndPos, String aTitleType)
aCAS
- the CAS in which to create the annotationaBeginPos
- the begin position of the annotation relative to the start of the documentaEndPos
- the end position of the annotation relative to the start of the document. (Note that,
as in the Java string functions, the end position is one past the last character in
the annotation, so that (end - begin) = length.aTitleType
- the type of person title. This becomes the value of the Kind
feature.Copyright © 2015. All rights reserved.