|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cmu.minorthird.text.AbstractAnnotator edu.cmu.minorthird.text.learn.ConfidenceReportingSequenceAnnotator
public class ConfidenceReportingSequenceAnnotator
Wraps an Annotator learned by SequenceAnnotatorLearner with code to compute confidences for each extracted span.
Sample use, in code:
// below, 'ann' might be trained, or pulled off disk - this
// is the sort of object that the SequenceAnnotatorLearner instances
// (like CRFAnnotatorLearner and VPHMMLearner) produce
SequenceAnnotatorLearner.SequenceAnnotator ann = ...;
ConfidenceReportingSequenceAnnotator crAnn = new ConfidenceReportingSequenceAnnotator(ann);
crAnn.annotate(textLabels);
// print the confidence of each extracted span
for (Span.Looper i=textLabels.instanceIterator(crAnn.getSpanType()); i.hasNext(); ) {
Span s = i.nextSpan();
Details d = labels.getDetails(s,crAnn.getSpanType());
System.out.println("confidence="+d.getConfidence()+" for span "+s);
}
Sample use, from command line:
Status: EXPERIMENTAL.
# train SequenceAnnotatorLearner.SequenceAnnotator object and save in 'old.ann'
% java edu.cmu.minorthird.ui.TrainExtractor -labels sample1.train -saveAs old.ann -spanType trueName
# convert to a ConfidenceReportingSequenceAnnotator 'new.ann'
% java edu.cmu.minorthird.text.learn.ConfidenceReportingSequenceAnnotator old.ann new.ann
# apply the annotator and view the results - the last column is confidence
% java edu.cmu.minorthird.ui.ApplyAnnotator -labels sample1.test -loadFrom new.ann -saveAs new.labels
% grep _prediction new.labels
addToType testStrings[0] 0 12 _prediction 141.0
addToType testStrings[1] 19 15 _prediction 312.0
addToType testStrings[2] 8 12 _prediction 188.0
addToType testStrings[3] 47 11 _prediction 374.0
Constructor Summary | |
---|---|
ConfidenceReportingSequenceAnnotator(SequenceAnnotatorLearner.SequenceAnnotator sequenceAnnotator)
|
Method Summary | |
---|---|
void |
doAnnotate(MonotonicTextLabels labels)
The implementation for this method annotates labels in-line. |
java.lang.String |
explainAnnotation(TextLabels labels,
Span documentSpan)
The implementation for this method should explain how annotation would be added to some part of the text base. |
java.lang.String |
getSpanType()
The spanType used to encode the spans extracted by the ExtractorAnnotator. |
static void |
main(java.lang.String[] args)
Convert an appropriately trained ExtractorAnnotator to a ConfidenceReportingSequenceAnnotator. |
Viewer |
toGUI()
Create a view of this object |
Methods inherited from class edu.cmu.minorthird.text.AbstractAnnotator |
---|
annotate, annotatedCopy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.cmu.minorthird.text.Annotator |
---|
annotate, annotatedCopy |
Constructor Detail |
---|
public ConfidenceReportingSequenceAnnotator(SequenceAnnotatorLearner.SequenceAnnotator sequenceAnnotator)
Method Detail |
---|
public java.lang.String getSpanType()
ExtractorAnnotator
getSpanType
in interface ExtractorAnnotator
public void doAnnotate(MonotonicTextLabels labels)
AbstractAnnotator
doAnnotate
in class AbstractAnnotator
public java.lang.String explainAnnotation(TextLabels labels, Span documentSpan)
AbstractAnnotator
explainAnnotation
in interface Annotator
explainAnnotation
in class AbstractAnnotator
public Viewer toGUI()
Visible
toGUI
in interface Visible
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |