de.fu_berlin.ties.eval
Class Mistake

java.lang.Object
  extended by de.fu_berlin.ties.eval.Mistake

public class Mistake
extends Object

Each instance of this class describe a mistake. They are used by the MistakeAnalyzer.

Version:
$Revision: 1.8 $, $Date: 2006/10/21 16:04:11 $, $Author: siefkes $
Author:
Christian Siefkes

Nested Class Summary
static class Mistake.MistakeTypes
          The types of mistakes that can occur.
 
Field Summary
static String CONFUSION_SEPARATOR
          Used in the confusion matrix to separated the (expected) answer key type from the actually encountered prediction type: " -> " (starts and ends with a space).
 
Constructor Summary
Mistake(Extraction myAnswerKey, Extraction myPrediction, SortedSet<Mistake.MistakeTypes> myMistakes, String mySource)
          Creates a new instance.
 
Method Summary
static String confusionType(Extraction ansKey, Extraction pred)
          Returns a string representing the the confusion between the types of an answer key.
static String flatten(SortedSet<Mistake.MistakeTypes> mistakeSet)
          Flattens a set of mistake types into a string.
 Extraction getAnswerKey()
          Returns the answer key involved in the mistake.
 SortedSet<Mistake.MistakeTypes> getMistakes()
          Returns the set of the mistake types that occurred.
 Extraction getPrediction()
          Returns prediction involved in the mistake.
 String getSource()
          Returns the source document where this mistake occurred.
 String toString()
          Returns a string representation of this object comprising 2 or 3 lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFUSION_SEPARATOR

public static final String CONFUSION_SEPARATOR
Used in the confusion matrix to separated the (expected) answer key type from the actually encountered prediction type: " -> " (starts and ends with a space).

See Also:
Constant Field Values
Constructor Detail

Mistake

public Mistake(Extraction myAnswerKey,
               Extraction myPrediction,
               SortedSet<Mistake.MistakeTypes> myMistakes,
               String mySource)
Creates a new instance. Either myAnswerKey or myPrediction might be null, but not both -- if myMistakes contains a "WrongType" mistake, neither may be null.

Parameters:
myAnswerKey - the answer key involved in the mistake (might be null)
myPrediction - the prediction involved in the mistake (might be null
myMistakes - a set of the mistake types that occurred
mySource - the source document where this mistake occurred
Method Detail

flatten

public static String flatten(SortedSet<Mistake.MistakeTypes> mistakeSet)
Flattens a set of mistake types into a string.

Parameters:
mistakeSet - the set of mistake types to flatten
Returns:
a flattened representation of the set

confusionType

public static String confusionType(Extraction ansKey,
                                   Extraction pred)
Returns a string representing the the confusion between the types of an answer key. The string will contain the type of the answer key and the type of the prection, separated by CONFUSION_SEPARATOR.

Parameters:
ansKey - the answer key
pred - the prediction
Returns:
a string representation as described above

getAnswerKey

public Extraction getAnswerKey()
Returns the answer key involved in the mistake.

Returns:
the value of the attribute (might be null)

getMistakes

public SortedSet<Mistake.MistakeTypes> getMistakes()
Returns the set of the mistake types that occurred.

Returns:
the value of the attribute

getPrediction

public Extraction getPrediction()
Returns prediction involved in the mistake.

Returns:
the value of the attribute (might be null)

getSource

public String getSource()
Returns the source document where this mistake occurred.

Returns:
the value of the attribute

toString

public String toString()
Returns a string representation of this object comprising 2 or 3 lines. The first line contains the flattened set of mistakes, followed by a space and the confusionType(Extraction, Extraction) if a Mistake.MistakeTypes.WrongType mistake occurred. The following line(s) contain the answer key (prefixed by "Answer: ") and the prediction (prefixed by "Prediction: ") if they are present (either of them must always be present, but not necessarily both). Answer keys and predictions are followed by their number of tokens in paranthesis (e.g. "(5 tokens)" or "(1 token)").

Overrides:
toString in class Object
Returns:
a string representation of this object as described above


Copyright © 2003-2007 Christian Siefkes. All Rights Reserved.