|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.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.
Nested 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. |
protected class |
AnnotationDiff.DiffSetElement
This class is used for internal purposes. |
Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
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 AnnotationDiffer |
annotDiffer
|
private Color |
BLACK
Used in some setForeground() methods |
private Color |
BLUE
Blue used for PARTIALLY_CORRECT_TYPE |
private Color[] |
colors
The array holding the colours according to the annotation types |
static int |
CORRECT_TYPE
A correct type when all annotation are corect represented by Green color |
private static boolean |
DEBUG
Debug flag |
static int |
DEFAULT_TYPE
A default type when all annotation are the same represented by White color |
private Set |
diffSet
Used to represent the result of diff. |
private XJTable |
diffTable
The components that will stay into diffPanel |
private double |
falsePositiveAverage
The False positive average (see NLP Information Extraction) |
private double |
falsePositiveLenient
The False positive lenient (see NLP Information Extraction) |
private double |
falsePositiveStrict
The False positive strict (see NLP Information Extraction) |
private double |
fMeasureAverage
The F-measure average (see NLP Information Extraction) |
private double |
fMeasureLenient
The F-measure lenient (see NLP Information Extraction) |
private double |
fMeasureStrict
The F-measure strict (see NLP Information Extraction) |
protected static NumberFormat |
formatter
A number formater for displaying precision and recall |
private Color |
GREEN
Green used for CORRECT_TYPE |
private String |
keyAnnotationSetName
The name of the annotation set. |
private List |
keyAnnotList
This list is created from keyAnnotationSet at init() time |
private Document |
keyDocument
This document contains the key annotation set which is taken as reference in comparison |
private Set |
keyFeatureNamesSet
A set of feature names bellonging to annotations from keyAnnotList used in isCompatible() and isPartiallyCompatible() methods |
private Set |
keyPartiallySet
This field is used in doDiff() and detectKeyType() methods and holds all partially correct keys |
static int |
MAX_TYPES
Field designated to represent the max nr of annot types and coolors for each type |
protected int |
maxUnitIncrement
|
static int |
MISSING_TYPE
A missing type when annotations in key were not present in response Represented by Yellow color |
private int |
NULL_TYPE
Used in DiffSetElement to represent an empty raw in the table |
static int |
PARTIALLY_CORRECT_TYPE
A partially correct type when all annotation are corect represented by Blue color |
private double |
precisionAverage
The precision average value (see NLP Information Extraction) |
private double |
precisionLenient
The precision lenient value (see NLP Information Extraction) |
private double |
precisionStrict
The precision strict value (see NLP Information Extraction) |
private double |
recallAverage
The Recall average value (see NLP Information Extraction) |
private double |
recallLenient
The Recall lenient value (see NLP Information Extraction) |
private double |
recallStrict
The Recall strict value (see NLP Information Extraction) |
private Color |
RED
Red used for SPURIOUS_TYPE |
private String |
responseAnnotationSetName
The name of the annotation set. |
private String |
responseAnnotationSetNameFalsePoz
The name of the annotation set considered in calculating FalsePozitive. |
private List |
responseAnnotList
This list is created from responseAnnotationSet at init() time |
private Document |
responseDocument
This document contains the response annotation set which is being compared against the key annotation set. |
private Set |
responsePartiallySet
This field is used in doDiff() and detectResponseType() methods |
private JScrollPane |
scrollPane
A scroll for the AnnotDiff's table |
static int |
SPURIOUS_TYPE
A spurious type when annotations in response were not present in key. |
private boolean |
textMode
This field indicates wheter or not the annot diff should run int the text mode |
private long[] |
typeCounter
Used to store the no. of annotations from response,identified as belonging to one of the previous types. |
static double |
weight
The weight used in F-measure (see NLP Information Extraction) |
private Color |
WHITE
White used for DEFAULT_TYPE |
private Color |
YELLOW
Yellow used for MISSING_TYPE |
Fields inherited from class gate.creole.AbstractVisualResource |
features, handle |
Fields inherited from class javax.swing.JPanel |
|
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
AnnotationDiff()
Constructs a AnnotationDif |
Method Summary | |
protected void |
arangeAllComponents()
This method creates the graphic components and aranges them on this JPanel |
AnnotationSchema |
getAnnotationSchema()
|
Set |
getAnnotationsOfType(int annotType)
Returns a set with all annotations of a specific type |
String |
getAnnotationTypeForFalsePositive()
Gets the annotation type needed to calculate the falsePossitive measure |
long |
getCorrectCount()
|
double |
getFalsePositiveAverage()
|
double |
getFalsePositiveLenient()
|
double |
getFalsePositiveStrict()
|
double |
getFMeasureAverage()
|
double |
getFMeasureLenient()
|
double |
getFMeasureStrict()
|
String |
getKeyAnnotationSetName()
Gets the keyAnnotationSetName. |
Document |
getKeyDocument()
|
Set |
getKeyFeatureNamesSet()
Gets the keyFeatureNamesSet in AnnotDiff. |
long |
getMissingCount()
|
long |
getPartiallyCorrectCount()
|
double |
getPrecisionAverage()
|
double |
getPrecisionLenient()
|
double |
getPrecisionStrict()
|
Dimension |
getPreferredScrollableViewportSize()
|
double |
getRecallAverage()
|
double |
getRecallLenient()
|
double |
getRecallStrict()
|
String |
getResponseAnnotationSetName()
gets the responseAnnotationSetName. |
String |
getResponseAnnotationSetNameFalsePoz()
gets the responseAnnotationSetNameFalsePoz. |
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
long |
getSpuriousCount()
|
Resource |
init()
This method does the diff, Precision,Recall,FalsePositive calculation and so on. |
boolean |
isTextMode()
Gets the annot diff textmode.True means that the text mode is activated. |
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 |
setKeyAnnotationSetName(String aKeyAnnotationSetName)
Sets the keyAnnotationSetName in AnnotDiff |
void |
setKeyDocument(Document aKeyDocument)
Sets the keyDocument in AnnotDiff |
void |
setKeyFeatureNamesSet(Set aKeyFeatureNamesSet)
Sets the keyFeatureNamesSet in AnnotDiff. |
void |
setResponseAnnotationSetName(String aResponseAnnotationSetName)
Sets the responseAnnotationSetName in AnnotDiff |
void |
setResponseAnnotationSetNameFalsePoz(String aResponseAnnotationSetNameFalsePoz)
Sets the responseAnnotationSetNameFalsePoz in AnnotDiff |
void |
setResponseDocument(Document aResponseDocument)
|
void |
setTextMode(Boolean aTextMode)
Sets the annot diff to work in the text mode.This would not initiate the GUI part of annot diff but it would calculate precision etc |
Methods inherited from class gate.creole.AbstractVisualResource |
cleanup, getFeatures, getParameterValue, setFeatures, setHandle, setParameterValue, setParameterValues, setTarget |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gate.util.NameBearer |
getName, setName |
Field Detail |
protected int maxUnitIncrement
private static final boolean DEBUG
private Document keyDocument
private String keyAnnotationSetName
private Document responseDocument
private String responseAnnotationSetName
private String responseAnnotationSetNameFalsePoz
private AnnotationSchema annotationSchema
private Set keyFeatureNamesSet
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
private boolean textMode
public static final int MAX_TYPES
public static final int DEFAULT_TYPE
public static final int CORRECT_TYPE
public static final int PARTIALLY_CORRECT_TYPE
public static final int SPURIOUS_TYPE
public static 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 int NULL_TYPE
private final Color BLACK
private Color[] colors
private JScrollPane scrollPane
private long[] typeCounter
private AnnotationDiffer annotDiffer
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 void setKeyAnnotationSetName(String aKeyAnnotationSetName)
aKeyAnnotationSetName
- The name of the annotation set from the
keyDocument.If aKeyAnnotationSetName is null then the default annotation
set will be used.public String getKeyAnnotationSetName()
public void setKeyFeatureNamesSet(Set aKeyFeatureNamesSet)
aKeyFeatureNamesSet
- a set containing the feature names from key
that will be used in isPartiallyCompatible()public Set getKeyFeatureNamesSet()
public void setResponseAnnotationSetName(String aResponseAnnotationSetName)
aResponseAnnotationSetName
- The name of the annotation set from the
responseDocument.If aResponseAnnotationSetName is null then the default
annotation set will be used.public String getResponseAnnotationSetName()
public void setResponseAnnotationSetNameFalsePoz(String aResponseAnnotationSetNameFalsePoz)
aResponseAnnotationSetNameFalsePoz
- The name of the annotation set
from the responseDocument.If aResponseAnnotationSetName is null
then the default annotation set will be used.public String getResponseAnnotationSetNameFalsePoz()
public void setTextMode(Boolean aTextMode)
public boolean isTextMode()
public Set getAnnotationsOfType(int annotType)
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 long getCorrectCount()
public long getPartiallyCorrectCount()
public long getSpuriousCount()
public long getMissingCount()
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 Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
public Resource init() throws ResourceInstantiationException
init
in interface Resource
init
in class AbstractVisualResource
ResourceInstantiationException
protected void arangeAllComponents()
protected void printStructure(Set aDiffSet)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |