|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.uima.analysis_component.AnalysisComponent_ImplBase
org.apache.uima.analysis_component.Annotator_ImplBase
org.apache.uima.analysis_component.JCasAnnotator_ImplBase
org.apache.uima.examples.tagger.HMMTagger
public class HMMTagger
UIMA Analysis Engine that invokes HMM POS tagger. HMM POS tagger generates part-of-speech tags for every token. This annotator assumes that sentences and tokens have already been annotated in the CAS with Sentence and Token annotations, respectively. We iterate over sentences, then iterate over tokens in the current sentence to accumulate a list of words, then invoke the HMM POS tagger on the list of words. For each Token we then update the posTag field with the POS tag. The model file for the HMM POS tagger is specified as a parameter (MODEL_FILE_PARAM).
The configuration of this analysis engine is done through several parameters:
Field Summary | |
---|---|
ModelGeneration |
my_model
|
int |
N
for a bigram model: N = 2, for a trigram model N=3 N is defined in parameter file |
static java.lang.String |
PARAM_IMPORT_MODEL_FILE
Name of the parameter for the model import path |
static java.lang.String |
PARAM_INPUT_VIEW
Name of the parameter for the input view |
static java.lang.String |
PARAM_SENTENCE
Name of the parameter for the annotation type which covers token annotations |
static java.lang.String |
PARAM_TOKEN_FP
Name of the parameter for the feature path to the token feature to be tagged |
Constructor Summary | |
---|---|
HMMTagger()
|
Method Summary | |
---|---|
static ModelGeneration |
get_model(java.lang.String filename)
Reads a saved MODEL object from a file |
static org.apache.uima.cas.Type |
getType(org.apache.uima.jcas.JCas aJCas,
java.lang.String annotationString)
Get the type of a given annotation name and check if it exists |
void |
initialize(org.apache.uima.UimaContext aContext)
Initialize the Annotator. |
void |
process(org.apache.uima.jcas.JCas aJCas)
Process a CAS. |
Methods inherited from class org.apache.uima.analysis_component.JCasAnnotator_ImplBase |
---|
getRequiredCasInterface, process |
Methods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase |
---|
getCasInstancesRequired, hasNext, next |
Methods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase |
---|
batchProcessComplete, collectionProcessComplete, destroy, getContext, getResultSpecification, reconfigure, setResultSpecification |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String PARAM_INPUT_VIEW
public static java.lang.String PARAM_IMPORT_MODEL_FILE
public static java.lang.String PARAM_SENTENCE
public static java.lang.String PARAM_TOKEN_FP
public int N
public ModelGeneration my_model
Constructor Detail |
---|
public HMMTagger()
Method Detail |
---|
public void initialize(org.apache.uima.UimaContext aContext) throws org.apache.uima.resource.ResourceInitializationException
initialize
in interface org.apache.uima.analysis_component.AnalysisComponent
initialize
in interface Tagger
initialize
in class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
org.apache.uima.resource.ResourceInitializationException
AnalysisComponent_ImplBase.initialize(UimaContext)
public static ModelGeneration get_model(java.lang.String filename)
MODEL
object from a file
filename
- model file
ModelGeneration
public void process(org.apache.uima.jcas.JCas aJCas) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
process
in interface Tagger
process
in class org.apache.uima.analysis_component.JCasAnnotator_ImplBase
org.apache.uima.analysis_engine.AnalysisEngineProcessException
JCasAnnotator_ImplBase.process(JCas)
public static org.apache.uima.cas.Type getType(org.apache.uima.jcas.JCas aJCas, java.lang.String annotationString) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
aJCas
- annotationString
-
org.apache.uima.analysis_engine.AnalysisEngineProcessException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |