gate.util
Class AnnotationDiffer

java.lang.Object
  extended bygate.util.AnnotationDiffer

public class AnnotationDiffer
extends Object


Nested Class Summary
static interface AnnotationDiffer.Pairing
           
 class AnnotationDiffer.PairingImpl
          Represents a pairing of a key annotation with a response annotation and the associated score for that pairing.
static class AnnotationDiffer.PairingOffsetComparator
           
protected static class AnnotationDiffer.PairingScoreComparator
           
 
Field Summary
static int CORRECT
           
static int CORRECT_TYPE
          A correct type when all annotation are correct represented by Green color
 HashSet correctAnnotations
           
protected  int correctMatches
           
protected  List finalChoices
          A list with the choices selected for the best result.
protected  List keyChoices
          A list of lists representing all possible choices for each key
protected  List keyList
          A list with all the key annotations
protected  int missing
           
static int MISSING_TYPE
          A missing type when annotations in key were not present in response Represented by Yellow color
 HashSet missingAnnotations
           
static int PARTIALLY_CORRECT
           
static int PARTIALLY_CORRECT_TYPE
          A partially correct type when all annotation are corect represented by Blue color
 HashSet partiallyCorrectAnnotations
           
protected  int partiallyCorrectMatches
           
protected  List possibleChoices
          All the posible choices are added to this list for easy iteration.
protected  List responseChoices
          A list of lists representing all possible choices for each response
protected  List responseList
          A list with all the response annotations
protected  int spurious
           
static int SPURIOUS_TYPE
          A spurious type when annotations in response were not present in key.
 HashSet spuriousAnnotations
           
static int WRONG
           
 
Constructor Summary
AnnotationDiffer()
           
 
Method Summary
protected  void addPairing(AnnotationDiffer.PairingImpl pairing, int index, List listOfPairings)
           
 List calculateDiff(Collection key, Collection response)
          Computes a diff between two collections of annotations.
 Set getAnnotationsOfType(int type)
          A method that returns specific type of annotations
 int getCorrectMatches()
           
 int getFalsePositivesLenient()
           
 int getFalsePositivesStrict()
           
 double getFMeasureAverage(double beta)
           
 double getFMeasureLenient(double beta)
           
 double getFMeasureStrict(double beta)
           
 int getKeysCount()
           
 int getMissing()
           
 int getPartiallyCorrectMatches()
           
 double getPrecisionAverage()
           
 double getPrecisionLenient()
           
 double getPrecisionStrict()
           
 double getRecallAverage()
           
 double getRecallLenient()
           
 double getRecallStrict()
           
 int getResponsesCount()
           
 Set getSignificantFeaturesSet()
           
 int getSpurious()
           
 void printMissmatches()
           
 void setSignificantFeaturesSet(Set significantFeaturesSet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

correctAnnotations

public HashSet correctAnnotations

partiallyCorrectAnnotations

public HashSet partiallyCorrectAnnotations

missingAnnotations

public HashSet missingAnnotations

spuriousAnnotations

public HashSet spuriousAnnotations

CORRECT_TYPE

public static final int CORRECT_TYPE
A correct type when all annotation are correct 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

CORRECT

public static final int CORRECT
See Also:
Constant Field Values

PARTIALLY_CORRECT

public static final int PARTIALLY_CORRECT
See Also:
Constant Field Values

WRONG

public static final int WRONG
See Also:
Constant Field Values

correctMatches

protected int correctMatches

partiallyCorrectMatches

protected int partiallyCorrectMatches

missing

protected int missing

spurious

protected int spurious

keyList

protected List keyList
A list with all the key annotations


responseList

protected List responseList
A list with all the response annotations


keyChoices

protected List keyChoices
A list of lists representing all possible choices for each key


responseChoices

protected List responseChoices
A list of lists representing all possible choices for each response


possibleChoices

protected List possibleChoices
All the posible choices are added to this list for easy iteration.


finalChoices

protected List finalChoices
A list with the choices selected for the best result.

Constructor Detail

AnnotationDiffer

public AnnotationDiffer()
Method Detail

calculateDiff

public List calculateDiff(Collection key,
                          Collection response)
Computes a diff between two collections of annotations.

Parameters:
key -
response -
Returns:
a list of AnnotationDiffer.Pairing objects representing the pairing set that results in the best score.

getPrecisionStrict

public double getPrecisionStrict()

getRecallStrict

public double getRecallStrict()

getPrecisionLenient

public double getPrecisionLenient()

getPrecisionAverage

public double getPrecisionAverage()

getRecallLenient

public double getRecallLenient()

getRecallAverage

public double getRecallAverage()

getFMeasureStrict

public double getFMeasureStrict(double beta)

getFMeasureLenient

public double getFMeasureLenient(double beta)

getFMeasureAverage

public double getFMeasureAverage(double beta)

getCorrectMatches

public int getCorrectMatches()

getPartiallyCorrectMatches

public int getPartiallyCorrectMatches()

getMissing

public int getMissing()

getSpurious

public int getSpurious()

getFalsePositivesStrict

public int getFalsePositivesStrict()

getFalsePositivesLenient

public int getFalsePositivesLenient()

getKeysCount

public int getKeysCount()

getResponsesCount

public int getResponsesCount()

printMissmatches

public void printMissmatches()

addPairing

protected void addPairing(AnnotationDiffer.PairingImpl pairing,
                          int index,
                          List listOfPairings)
Parameters:
pairing - the pairing to be added
index - the index in the list of pairings
listOfPairings - the list of AnnotationDiffer.Pairings where the pairing should be added

getSignificantFeaturesSet

public Set getSignificantFeaturesSet()

setSignificantFeaturesSet

public void setSignificantFeaturesSet(Set significantFeaturesSet)

getAnnotationsOfType

public Set getAnnotationsOfType(int type)
A method that returns specific type of annotations

Parameters:
type -
Returns:
a Set of AnnotationDiffer.Pairings.