|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--gate.creole.AbstractVisualResource | +--gate.annotation.AnnotationDiff
This class compare two annotation sets on annotation type given by the AnnotationSchema object. It also deals with graphic representation of the result.
Inner Class Summary | |
class |
AnnotationDiff.AnnotationDiffCellRenderer
This class defines a Cell renderer for the AnnotationDiff table |
protected class |
AnnotationDiff.AnnotationDiffTableModel
A custom table model used to render a table containing the two annotation sets. |
(package private) class |
AnnotationDiff.AnnotationSetComparator
|
protected class |
AnnotationDiff.DiffSetElement
This class is used for internal purposes. |
Inner classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent, JComponent.ActionStandin, JComponent.IntVector, JComponent.KeyboardState |
Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.AWTTreeLock |
Field Summary | |
private AnnotationSchema |
annotationSchema
The annotation schema object used to get the annotation name |
private String |
annotationTypeForFalsePositive
This string represents the type of annotations used to play the roll of total number of words needed to calculate the False Positive. |
private Color |
BLACK
|
private Color |
BLUE
|
private Color[] |
colors
|
int |
CORRECT_TYPE
|
private static boolean |
DEBUG
Debug flag |
int |
DEFAULT_TYPE
|
private Set |
diffSet
Used to represent the result of diff. |
private XJTable |
diffTable
The components that will stay into diffPanel |
private double |
falsePositiveAverage
|
private double |
falsePositiveLenient
|
private double |
falsePositiveStrict
The False positive (see NLP Information Extraction) |
private double |
fMeasureAverage
|
private double |
fMeasureLenient
|
private double |
fMeasureStrict
The F-measure and weight (see NLP Information Extraction) |
protected static NumberFormat |
formatter
A number formater for displaying precision and recall |
private Color |
GREEN
|
private List |
keyAnnotList
This lists are created from keyAnnotationSet and responseAnnotationSet |
private Document |
keyDocument
This document contains the key annotation set which is taken as reference in comparison |
private Set |
keyPartiallySet
These fields are used in doDiff() and detectKey(Response)Type() |
int |
MAX_TYPES
Fields used to describe the type of annotations |
int |
MISSING_TYPE
|
int |
NULL_TYPE
|
int |
PARTIALLY_CORRECT_TYPE
|
private double |
precisionAverage
|
private double |
precisionLenient
|
private double |
precisionStrict
The Precision value (see NLP Information Extraction) |
private double |
recallAverage
|
private double |
recallLenient
|
private double |
recallStrict
The Recall value (see NLP Information Extraction) |
private Color |
RED
|
private List |
responseAnnotList
|
private Document |
responseDocument
This document contains the response annotation set which is being compared against the key annotation set. |
private Set |
responsePartiallySet
|
(package private) JScrollPane |
scrollPane
|
int |
SPURIOUS_TYPE
|
private int[] |
typeCounter
Used to store the no. |
static double |
weight
|
private Color |
WHITE
|
private Color |
YELLOW
|
Fields inherited from class gate.creole.AbstractVisualResource |
features |
Fields inherited from class javax.swing.JPanel |
defaultLayout, uiClassID |
Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
AnnotationDiff()
Constructs a AnnotationDif |
Method Summary | |
private void |
addToDiffset(AnnotationDiff.DiffSetElement aDiffSetElement)
This method add an DiffsetElement to the DiffSet and also counts the number of compatible, partialCompatible, Incorect and Missing annotations. |
protected void |
arangeAllComponents()
This method creates the graphic components and aranges them on this JPanel |
private int |
detectKeyType(Annotation anAnnot)
Decide what type is the keyAnnotation (DEFAULT_TYPE, MISSING or NULL_TYPE) This method must be applied only on annotation from key set. |
private int |
detectResponseType(Annotation anAnnot)
Decide what type is the responseAnnotation (PARTIALLY_CORRECT_TYPE, SPURIOUS or NULL_TYPE) This method must be applied only on annotation from response set. |
protected void |
doDiff(List aKeyAnnotList,
List aResponseAnnotList)
This method is the brain of the AnnotationSet diff and creates a set with diffSetElement objects. |
AnnotationSchema |
getAnnotationSchema()
|
String |
getAnnotationTypeForFalsePositive()
Gets the annotation type needed to calculate the falsePossitive measure |
double |
getFalsePositiveAverage()
|
double |
getFalsePositiveLenient()
|
double |
getFalsePositiveStrict()
|
double |
getFMeasureAverage()
|
double |
getFMeasureLenient()
|
double |
getFMeasureStrict()
|
Document |
getKeyDocument()
|
double |
getPrecisionAverage()
|
double |
getPrecisionLenient()
|
double |
getPrecisionStrict()
|
double |
getRecallAverage()
|
double |
getRecallLenient()
|
double |
getRecallStrict()
|
Resource |
init()
This method does the diff, Precision,Recall,FalsePositive calculation and so on. |
protected void |
printStructure(Set aDiffSet)
Used internally for debugging |
void |
setAnnotationSchema(AnnotationSchema anAnnotationSchema)
|
void |
setAnnotationTypeForFalsePositive(String anAnnotType)
Sets the annotation type needed to calculate the falsePossitive measure |
void |
setKeyDocument(Document aKeyDocument)
Sets the keyDocument in AnnotDiff |
void |
setResponseDocument(Document aResponseDocument)
|
Methods inherited from class gate.creole.AbstractVisualResource |
getFeatures, setFeatures |
Methods inherited from class javax.swing.JPanel |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Methods inherited from interface gate.util.FeatureBearer |
getName, setName |
Field Detail |
private static final boolean DEBUG
private Document keyDocument
private Document responseDocument
private AnnotationSchema annotationSchema
private double precisionStrict
private double precisionLenient
private double precisionAverage
private double recallStrict
private double recallLenient
private double recallAverage
private double falsePositiveStrict
private double falsePositiveLenient
private double falsePositiveAverage
private double fMeasureStrict
private double fMeasureLenient
private double fMeasureAverage
public static double weight
private String annotationTypeForFalsePositive
protected static NumberFormat formatter
private XJTable diffTable
private Set diffSet
private Set keyPartiallySet
private Set responsePartiallySet
private List keyAnnotList
private List responseAnnotList
public final int MAX_TYPES
public final int NULL_TYPE
public final int DEFAULT_TYPE
public final int CORRECT_TYPE
public final int PARTIALLY_CORRECT_TYPE
public final int SPURIOUS_TYPE
public final int MISSING_TYPE
private final Color RED
private final Color GREEN
private final Color WHITE
private final Color BLUE
private final Color YELLOW
private final Color BLACK
private Color[] colors
JScrollPane scrollPane
private int[] typeCounter
Constructor Detail |
public AnnotationDiff()
Method Detail |
public void setAnnotationTypeForFalsePositive(String anAnnotType)
anAnnotType
- is the annotation type needed to calculate a special
mesure called falsePossitive. Usualy the value is "token", but it can be
any other string with the same semantic.public String getAnnotationTypeForFalsePositive()
public void setKeyDocument(Document aKeyDocument)
aKeyDocument
- The GATE document used as a key in annotation diff.public Document getKeyDocument()
public double getPrecisionStrict()
public double getPrecisionLenient()
public double getPrecisionAverage()
public double getFMeasureStrict()
public double getFMeasureLenient()
public double getFMeasureAverage()
public double getRecallStrict()
public double getRecallLenient()
public double getRecallAverage()
public double getFalsePositiveStrict()
public double getFalsePositiveLenient()
public double getFalsePositiveAverage()
public void setResponseDocument(Document aResponseDocument)
aResponseDocument
- the GATE response Document
containing the annotation Set being compared against the annotation from
the keyDocument.public void setAnnotationSchema(AnnotationSchema anAnnotationSchema)
anAnnotationSchema
- the annotation type being compared.
This type is found in annotationSchema object as field
AnnotationSchema.getAnnotationName()
. If is null
then AnnotDiff will throw an exception when it comes to do the diff.public AnnotationSchema getAnnotationSchema()
public Resource init() throws ResourceInstantiationException
init
in class AbstractVisualResource
protected void arangeAllComponents()
protected void printStructure(Set aDiffSet)
protected void doDiff(List aKeyAnnotList, List aResponseAnnotList)
aKeyAnnotList
- a list containing the annotations from key. If this
param is null then the method will simply return and will not do a
thing.aResponseAnnotList
- a list containing the annotation from response.
If this param is null the method will return.private int detectKeyType(Annotation anAnnot)
anAnnot
- is an annotation from the key set.private int detectResponseType(Annotation anAnnot)
anAnnot
- is an annotation from the key set.private void addToDiffset(AnnotationDiff.DiffSetElement aDiffSetElement)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |