public class HMMannotator extends Object
| Constructor and Description |
|---|
HMMannotator(TokenClassifier h)
create a new annotator based on HMM h.
|
| Modifier and Type | Method and Description |
|---|---|
void |
annotate(Document doc)
use the HMM to add annotations to Document 'doc'.
|
void |
annotateNbest(Document doc,
int n,
String hypId)
use the HMM to add N-best annotations to Document 'doc'.
|
void |
annotateSpan(Document doc,
Span textSpan)
use the HMM to add annotations to Span 'textSpan' of Document 'doc'.
|
ArrayList |
annotateSpanNbest(Document doc,
Span textSpan,
int n,
String hypId)
use the HMM to add annotations to Span 'textSpan' of Document 'doc'.
|
String[][] |
getTagTable()
returns the tag table (the correspondence between HMM tags and
annotation types and features).
|
void |
readTagTable(BufferedReader in)
read the tag table (the list of annotation types and features)
from BufferedReader 'in'.
|
void |
readTagTable(String tagFileName)
read the tag table (the list of annotation types and features)
from file 'tagFileName'.
|
void |
setAnnotateEachToken(boolean flag)
sets / clears the annotateEachToken flag, which applies only if BItag == false.
|
void |
setBItag(boolean flag)
sets / clears the BItag flag.
|
void |
setRecordMargin(boolean recordMargin)
turn on/off the feature that records the margin associated with an
annotation as a feature 'margin' on the annotation.
|
void |
setRecordProb(boolean recordProbability)
turn on/off the feature that records the (log) probability of
the assignment of tags to a span of text.
|
void |
setTagTable(String[][] table)
define the tag table for the annotator -- the correspondence between the
tags associated with the states and the annotations on the documents.
|
void |
setTrace(boolean trace)
turn on / off the trace
|
void |
setZoneToTag(String zone)
sets the zones to be annotated.
|
void |
train(Document doc)
use the annotations on Document 'doc' to train the HMM.
|
void |
train(DocumentCollection col)
use the annotations on all documents in DocumentCollection 'col'
to train HMM 'h'.
|
void |
trainOnSpan(Document doc,
Span textSpan)
use the annotations on Span 'span' of Document 'doc' to train the HMM.
|
void |
writeTagTable(BufferedWriter pw)
writes the tag table (the correspondence between HMM tags and
annotation types and features) to PrintWriter 'pw'.
|
public HMMannotator(TokenClassifier h)
public void setTagTable(String[][] table)
public void readTagTable(String tagFileName)
public void readTagTable(BufferedReader in)
public void writeTagTable(BufferedWriter pw)
public String[][] getTagTable()
public void setBItag(boolean flag)
public void setAnnotateEachToken(boolean flag)
public void setZoneToTag(String zone)
public void setTrace(boolean trace)
public void setRecordMargin(boolean recordMargin)
public void setRecordProb(boolean recordProbability)
public void train(Document doc)
public void trainOnSpan(Document doc, Span textSpan)
public void train(DocumentCollection col)
public void annotate(Document doc)
public void annotateNbest(Document doc, int n, String hypId)
hypId followed by
the hypothesis number.public void annotateSpan(Document doc, Span textSpan)
public ArrayList annotateSpanNbest(Document doc, Span textSpan, int n, String hypId)
n most likely state sequences are computed
for each token sequence. The tags on the resulting states
are used to generate annotations (based on the tagTable). The annotations
for the ith most likely state sequence are marked as a hypothesis
with hypo feature hypId-i.Copyright © 2016 New York University. All rights reserved.