gate.annotation
Class CorpusAnnotationDiff

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--gate.creole.AbstractVisualResource
                                |
                                +--gate.annotation.CorpusAnnotationDiff
All Implemented Interfaces:
Accessible, FeatureBearer, ImageObserver, MenuContainer, NameBearer, Resource, Scrollable, Serializable, VisualResource

public class CorpusAnnotationDiff
extends AbstractVisualResource
implements Scrollable

This class compare two annotation sets on annotation type given by the AnnotationSchema object. It also deals with graphic representation of the result.

See Also:
Serialized Form

Nested Class Summary
 class CorpusAnnotationDiff.AnnotationDiffCellRenderer
          This class defines a Cell renderer for the AnnotationDiff table
protected  class CorpusAnnotationDiff.AnnotationDiffTableModel
          A custom table model used to render a table containing the two annotation sets.
(package private)  class CorpusAnnotationDiff.AnnotationSetComparator
           
protected  class CorpusAnnotationDiff.DiffSetElement
          This class is used for internal purposes.
 
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
          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  Corpus keyCorpus
          This corpus contains the key annotation set which is taken as reference in comparison
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  Corpus responseCorpus
          This corpus contains the response annotation set which is being compared against the key annotation set.
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  int[] typeCounter
          Used to store the no.
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
 
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
CorpusAnnotationDiff()
          Constructs a CorpusAnnotationDiff
 
Method Summary
private  void addToDiffset(CorpusAnnotationDiff.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()
           
 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
 double getFalsePositiveAverage()
           
 double getFalsePositiveLenient()
           
 double getFalsePositiveStrict()
           
 double getFMeasureAverage()
           
 double getFMeasureLenient()
           
 double getFMeasureStrict()
           
 String getKeyAnnotationSetName()
          Gets the keyAnnotationSetName.
 Corpus getKeyCorpus()
           
 Set getKeyFeatureNamesSet()
          Gets the keyFeatureNamesSet in AnnotDiff.
 Object getParameterValue(String paramaterName)
          Gets the value of a parameter of this resource.
 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)
           
 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 setKeyCorpus(Corpus aKeyCorpus)
          Sets the keyCorpus in AnnotDiff
 void setKeyFeatureNamesSet(Set aKeyFeatureNamesSet)
          Sets the keyFeatureNamesSet in AnnotDiff.
 void setParameterValue(String paramaterName, Object parameterValue)
          Sets the value for a specified parameter.
 void setParameterValues(FeatureMap parameters)
          Sets the values for more parameters in one step.
 void setResponseAnnotationSetName(String aResponseAnnotationSetName)
          Sets the responseAnnotationSetName in AnnotDiff
 void setResponseAnnotationSetNameFalsePoz(String aResponseAnnotationSetNameFalsePoz)
          Sets the responseAnnotationSetNameFalsePoz in AnnotDiff
 void setResponseCorpus(Corpus aResponseCorpus)
           
 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, setFeatures, setHandle, setTarget
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
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

maxUnitIncrement

protected int maxUnitIncrement

DEBUG

private static final boolean DEBUG
Debug flag

See Also:
Constant Field Values

keyDocument

private Document keyDocument
This document contains the key annotation set which is taken as reference in comparison


keyCorpus

private Corpus keyCorpus
This corpus contains the key annotation set which is taken as reference in comparison


keyAnnotationSetName

private String keyAnnotationSetName
The name of the annotation set. If is null then the default annotation set will be considered.


responseDocument

private Document responseDocument
This document contains the response annotation set which is being compared against the key annotation set.


responseCorpus

private Corpus responseCorpus
This corpus contains the response annotation set which is being compared against the key annotation set.


responseAnnotationSetName

private String responseAnnotationSetName
The name of the annotation set. If is null then the default annotation set will be considered.


responseAnnotationSetNameFalsePoz

private String responseAnnotationSetNameFalsePoz
The name of the annotation set considered in calculating FalsePozitive. If is null then the default annotation set will be considered.


annotationSchema

private AnnotationSchema annotationSchema
The annotation schema object used to get the annotation name


keyFeatureNamesSet

private Set keyFeatureNamesSet
A set of feature names bellonging to annotations from keyAnnotList used in isCompatible() and isPartiallyCompatible() methods


precisionStrict

private double precisionStrict
The precision strict value (see NLP Information Extraction)


precisionLenient

private double precisionLenient
The precision lenient value (see NLP Information Extraction)


precisionAverage

private double precisionAverage
The precision average value (see NLP Information Extraction)


recallStrict

private double recallStrict
The Recall strict value (see NLP Information Extraction)


recallLenient

private double recallLenient
The Recall lenient value (see NLP Information Extraction)


recallAverage

private double recallAverage
The Recall average value (see NLP Information Extraction)


falsePositiveStrict

private double falsePositiveStrict
The False positive strict (see NLP Information Extraction)


falsePositiveLenient

private double falsePositiveLenient
The False positive lenient (see NLP Information Extraction)


falsePositiveAverage

private double falsePositiveAverage
The False positive average (see NLP Information Extraction)


fMeasureStrict

private double fMeasureStrict
The F-measure strict (see NLP Information Extraction)


fMeasureLenient

private double fMeasureLenient
The F-measure lenient (see NLP Information Extraction)


fMeasureAverage

private double fMeasureAverage
The F-measure average (see NLP Information Extraction)


weight

public static double weight
The weight used in F-measure (see NLP Information Extraction)


annotationTypeForFalsePositive

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.


formatter

protected static NumberFormat formatter
A number formater for displaying precision and recall


diffTable

private XJTable diffTable
The components that will stay into diffPanel


diffSet

private Set diffSet
Used to represent the result of diff. See DiffSetElement class.


keyPartiallySet

private Set keyPartiallySet
This field is used in doDiff() and detectKeyType() methods and holds all partially correct keys


responsePartiallySet

private Set responsePartiallySet
This field is used in doDiff() and detectResponseType() methods


keyAnnotList

private List keyAnnotList
This list is created from keyAnnotationSet at init() time


responseAnnotList

private List responseAnnotList
This list is created from responseAnnotationSet at init() time


textMode

private boolean textMode
This field indicates wheter or not the annot diff should run int the text mode


MAX_TYPES

public static final int MAX_TYPES
Field designated to represent the max nr of annot types and coolors for each type

See Also:
Constant Field Values

DEFAULT_TYPE

public static final int DEFAULT_TYPE
A default type when all annotation are the same represented by White color

See Also:
Constant Field Values

CORRECT_TYPE

public static final int CORRECT_TYPE
A correct type when all annotation are corect represented by Green color

See Also:
Constant Field Values

PARTIALLY_CORRECT_TYPE

public static final int PARTIALLY_CORRECT_TYPE
A partially correct type when all annotation are corect represented by Blue color

See Also:
Constant Field Values

SPURIOUS_TYPE

public static final int SPURIOUS_TYPE
A spurious type when annotations in response were not present in key. Represented by Red color

See Also:
Constant Field Values

MISSING_TYPE

public static final int MISSING_TYPE
A missing type when annotations in key were not present in response Represented by Yellow color

See Also:
Constant Field Values

RED

private final Color RED
Red used for SPURIOUS_TYPE


GREEN

private final Color GREEN
Green used for CORRECT_TYPE


WHITE

private final Color WHITE
White used for DEFAULT_TYPE


BLUE

private final Color BLUE
Blue used for PARTIALLY_CORRECT_TYPE


YELLOW

private final Color YELLOW
Yellow used for MISSING_TYPE


NULL_TYPE

private final int NULL_TYPE
Used in DiffSetElement to represent an empty raw in the table

See Also:
Constant Field Values

BLACK

private final Color BLACK
Used in some setForeground() methods


colors

private Color[] colors
The array holding the colours according to the annotation types


scrollPane

private JScrollPane scrollPane
A scroll for the AnnotDiff's table


typeCounter

private int[] typeCounter
Used to store the no. of annotations from response,identified as belonging to one of the previous types.

Constructor Detail

CorpusAnnotationDiff

public CorpusAnnotationDiff()
Constructs a CorpusAnnotationDiff

Method Detail

setAnnotationTypeForFalsePositive

public void setAnnotationTypeForFalsePositive(String anAnnotType)
Sets the annotation type needed to calculate the falsePossitive measure

Parameters:
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.

getAnnotationTypeForFalsePositive

public String getAnnotationTypeForFalsePositive()
Gets the annotation type needed to calculate the falsePossitive measure

Returns:
annotation type needed to calculate a special mesure called falsePossitive.

setKeyCorpus

public void setKeyCorpus(Corpus aKeyCorpus)
Sets the keyCorpus in AnnotDiff

Parameters:
aKeyCorpus - The GATE corpus used as a key in annotation diff.

getKeyCorpus

public Corpus getKeyCorpus()
Returns:
the keyCorpus used in AnnotDiff process

setKeyAnnotationSetName

public void setKeyAnnotationSetName(String aKeyAnnotationSetName)
Sets the keyAnnotationSetName in AnnotDiff

Parameters:
aKeyAnnotationSetName - The name of the annotation set from the keyDocument.If aKeyAnnotationSetName is null then the default annotation set will be used.

getKeyAnnotationSetName

public String getKeyAnnotationSetName()
Gets the keyAnnotationSetName.

Returns:
The name of the keyAnnotationSet used in AnnotationDiff. If returns null then the the default annotation set will be used.

setKeyFeatureNamesSet

public void setKeyFeatureNamesSet(Set aKeyFeatureNamesSet)
Sets the keyFeatureNamesSet in AnnotDiff.

Parameters:
aKeyFeatureNamesSet - a set containing the feature names from key that will be used in isPartiallyCompatible()

getKeyFeatureNamesSet

public Set getKeyFeatureNamesSet()
Gets the keyFeatureNamesSet in AnnotDiff.

Returns:
A set containing the feature names from key that will be used in isPartiallyCompatible()

setResponseAnnotationSetName

public void setResponseAnnotationSetName(String aResponseAnnotationSetName)
Sets the responseAnnotationSetName in AnnotDiff

Parameters:
aResponseAnnotationSetName - The name of the annotation set from the responseDocument.If aResponseAnnotationSetName is null then the default annotation set will be used.

getResponseAnnotationSetName

public String getResponseAnnotationSetName()
gets the responseAnnotationSetName.

Returns:
The name of the responseAnnotationSet used in AnnotationDiff. If returns null then the the default annotation set will be used.

setResponseAnnotationSetNameFalsePoz

public void setResponseAnnotationSetNameFalsePoz(String aResponseAnnotationSetNameFalsePoz)
Sets the responseAnnotationSetNameFalsePoz in AnnotDiff

Parameters:
aResponseAnnotationSetNameFalsePoz - The name of the annotation set from the responseDocument.If aResponseAnnotationSetName is null then the default annotation set will be used.

getResponseAnnotationSetNameFalsePoz

public String getResponseAnnotationSetNameFalsePoz()
gets the responseAnnotationSetNameFalsePoz.

Returns:
The name of the responseAnnotationSetFalsePoz used in AnnotationDiff. If returns null then the the default annotation set will be used.

setTextMode

public 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


isTextMode

public boolean isTextMode()
Gets the annot diff textmode.True means that the text mode is activated.


getAnnotationsOfType

public Set getAnnotationsOfType(int annotType)
Returns a set with all annotations of a specific type


getParameterValue

public Object getParameterValue(String paramaterName)
                         throws ResourceInstantiationException
Gets the value of a parameter of this resource.

Specified by:
getParameterValue in interface Resource
Overrides:
getParameterValue in class AbstractVisualResource
Parameters:
paramaterName - the name of the parameter
Returns:
the current value of the parameter
ResourceInstantiationException

setParameterValue

public void setParameterValue(String paramaterName,
                              Object parameterValue)
                       throws ResourceInstantiationException
Sets the value for a specified parameter.

Specified by:
setParameterValue in interface Resource
Overrides:
setParameterValue in class AbstractVisualResource
Parameters:
paramaterName - the name for the parameteer
parameterValue - the value the parameter will receive
ResourceInstantiationException

setParameterValues

public void setParameterValues(FeatureMap parameters)
                        throws ResourceInstantiationException
Sets the values for more parameters in one step.

Specified by:
setParameterValues in interface Resource
Overrides:
setParameterValues in class AbstractVisualResource
Parameters:
parameters - a feature map that has paramete names as keys and parameter values as values.
ResourceInstantiationException

getPrecisionStrict

public double getPrecisionStrict()
Returns:
the precisionStrict field

getPrecisionLenient

public double getPrecisionLenient()
Returns:
the precisionLenient field

getPrecisionAverage

public double getPrecisionAverage()
Returns:
the precisionAverage field

getFMeasureStrict

public double getFMeasureStrict()
Returns:
the fMeasureStrict field

getFMeasureLenient

public double getFMeasureLenient()
Returns:
the fMeasureLenient field

getFMeasureAverage

public double getFMeasureAverage()
Returns:
the fMeasureAverage field

getRecallStrict

public double getRecallStrict()
Returns:
the recallStrict field

getRecallLenient

public double getRecallLenient()
Returns:
the recallLenient field

getRecallAverage

public double getRecallAverage()
Returns:
the recallAverage field

getFalsePositiveStrict

public double getFalsePositiveStrict()
Returns:
the falsePositiveStrict field

getFalsePositiveLenient

public double getFalsePositiveLenient()
Returns:
the falsePositiveLenient field

getFalsePositiveAverage

public double getFalsePositiveAverage()
Returns:
the falsePositiveAverage field

setResponseCorpus

public void setResponseCorpus(Corpus aResponseCorpus)
Parameters:
aResponseCorpus - the GATE response corpus containing the annotation Set being compared against the annotation from the keyCorpus.

setAnnotationSchema

public void setAnnotationSchema(AnnotationSchema anAnnotationSchema)
Parameters:
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.

getAnnotationSchema

public AnnotationSchema getAnnotationSchema()
Returns:
the annotation schema object used in annotation diff process

getPreferredScrollableViewportSize

public Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Specified by:
getScrollableUnitIncrement in interface Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Specified by:
getScrollableBlockIncrement in interface Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface Scrollable

init

public Resource init()
              throws ResourceInstantiationException
This method does the diff, Precision,Recall,FalsePositive calculation and so on.

Specified by:
init in interface Resource
Overrides:
init in class AbstractVisualResource
ResourceInstantiationException

arangeAllComponents

protected void arangeAllComponents()
This method creates the graphic components and aranges them on this JPanel


printStructure

protected void printStructure(Set aDiffSet)
Used internally for debugging


doDiff

protected void doDiff(List aKeyAnnotList,
                      List aResponseAnnotList)
This method is the brain of the AnnotationSet diff and creates a set with diffSetElement objects.

Parameters:
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.

detectKeyType

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.

Parameters:
anAnnot - is an annotation from the key set.
Returns:
three possible value(DEFAULT_TYPE, MISSING or NULL_TYPE)

detectResponseType

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.

Parameters:
anAnnot - is an annotation from the key set.
Returns:
three possible value(PARTIALLY_CORRECT_TYPE, SPURIOUS or NULL_TYPE)

addToDiffset

private void addToDiffset(CorpusAnnotationDiff.DiffSetElement aDiffSetElement)
This method add an DiffsetElement to the DiffSet and also counts the number of compatible, partialCompatible, Incorect and Missing annotations.