|
|||||||||||
| 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 String |
PARAM_IMPORT_MODEL_FILE
Name of the parameter for the model import path |
static String |
PARAM_INPUT_VIEW
Name of the parameter for the input view |
static String |
PARAM_SENTENCE
Name of the parameter for the annotation type which covers token annotations |
static 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(String filename)
Reads a saved MODEL object from a file |
static org.apache.uima.cas.Type |
getType(org.apache.uima.jcas.JCas aJCas,
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 String PARAM_INPUT_VIEW
public static String PARAM_IMPORT_MODEL_FILE
public static String PARAM_SENTENCE
public static 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.AnalysisComponentinitialize in interface Taggerinitialize in class org.apache.uima.analysis_component.AnalysisComponent_ImplBaseorg.apache.uima.resource.ResourceInitializationExceptionAnalysisComponent_ImplBase.initialize(UimaContext)public static ModelGeneration get_model(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 Taggerprocess in class org.apache.uima.analysis_component.JCasAnnotator_ImplBaseorg.apache.uima.analysis_engine.AnalysisEngineProcessExceptionJCasAnnotator_ImplBase.process(JCas)
public static org.apache.uima.cas.Type getType(org.apache.uima.jcas.JCas aJCas,
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 | ||||||||||