cic.wsd.testing
Class Decision

java.lang.Object
  extended by cic.wsd.testing.Decision

public class Decision
extends java.lang.Object

Class for storing a decision made by the disambiguation algorithm.

Author:
Francisco Viveros-Jiménez

Field Summary
(package private)  int[] answers
          Senses selected by the algorithm.
(package private)  boolean attempted
          True, if the algorithms sets at least a single weight.
(package private)  java.util.ArrayList<java.util.ArrayList<java.lang.String>> decisionWords
          Array containing the words used for scoring each sense of the target word.
(package private)  AmbiguousWord target
          The disambiguated word.
(package private)  double[] weights
          Array containing sense weights given by the disambiguation algorithm.
(package private)  java.util.ArrayList<AmbiguousWord> window
          Context words used for disambiguating a word.
 
Constructor Summary
Decision(AmbiguousWord target, java.util.ArrayList<AmbiguousWord> window)
          Prepares a new decision with empty weights.
 
Method Summary
 void calculateAnswer()
          This method is the one who sets the system answers.
 int[] getAnswers()
          Returns the answers of the algorithm.
 java.lang.String getAnswersString()
          Returns "( [answer1 [,answerN]*]* )".
 java.util.ArrayList<java.lang.String> getDecisionWords(int sense)
          Returns the words used for scoring a sense.
 double getScore()
          Calculates this decision's score following the Senseval score system.
 int getSenseCount()
          Returns the number of senses disambiguated.
 int getSensesAddressedCount()
          Returns a count of the number of senses with a score>0
 AmbiguousWord getTarget()
          Returns the target word.
 double[] getWeights()
          Returns the scores of each sense.
 java.util.ArrayList<AmbiguousWord> getWindow()
          Returns the window.
 java.lang.String getWindowPrint()
          Returns "[windowWord1,...
 boolean isAttempted()
          Returns true, if the algorithms sets at least a single weight.
 boolean isCorrect(int answer)
          Returns true if answer is among the correct senses.
 boolean isCorrectSenseAddressed()
          Returns true, if an algorithm answer are among the correct answers.
 boolean isTied()
          Returns true, if the algorithm returned more than one correct answer.
 void setSense(int sense, double w, java.util.ArrayList<java.lang.String> words)
          Sets a sense weight and the words used for scoring the sense.
 void unTie(Decision tie)
          Solves a tie with the answer provided by another disambiguation approach.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

answers

int[] answers
Senses selected by the algorithm.


target

AmbiguousWord target
The disambiguated word.


window

java.util.ArrayList<AmbiguousWord> window
Context words used for disambiguating a word.


decisionWords

java.util.ArrayList<java.util.ArrayList<java.lang.String>> decisionWords
Array containing the words used for scoring each sense of the target word.


weights

double[] weights
Array containing sense weights given by the disambiguation algorithm.


attempted

boolean attempted
True, if the algorithms sets at least a single weight.

Constructor Detail

Decision

public Decision(AmbiguousWord target,
                java.util.ArrayList<AmbiguousWord> window)
Prepares a new decision with empty weights.

Parameters:
target - The disambiguated word.
window - Words used for disambiguating the target.
Method Detail

setSense

public void setSense(int sense,
                     double w,
                     java.util.ArrayList<java.lang.String> words)
Sets a sense weight and the words used for scoring the sense.

Parameters:
sense - Measured sense.
w - Weight given by the disambiguation algorithm.
words - The words used for scoring this sense. words must be an empty ArrayList if w=0.

getDecisionWords

public java.util.ArrayList<java.lang.String> getDecisionWords(int sense)
Returns the words used for scoring a sense.

Parameters:
sense - Target sense number.
Returns:
The words used for scoring a sense.

isAttempted

public boolean isAttempted()
Returns true, if the algorithms sets at least a single weight.

Returns:
True, if the algorithms sets at least a single weight.

calculateAnswer

public void calculateAnswer()
This method is the one who sets the system answers. This method picks the sense(s) with the highest weight.


getAnswers

public int[] getAnswers()
Returns the answers of the algorithm.

Returns:
answers

getTarget

public AmbiguousWord getTarget()
Returns the target word.

Returns:
target

getWindow

public java.util.ArrayList<AmbiguousWord> getWindow()
Returns the window.

Returns:
window

getWeights

public double[] getWeights()
Returns the scores of each sense.

Returns:
weights

getWindowPrint

public java.lang.String getWindowPrint()
Returns "[windowWord1,...,windowWordN]".

Returns:
"[windowWord1,...,windowWordN]"

getSenseCount

public int getSenseCount()
Returns the number of senses disambiguated.

Returns:
The number of senses disambiguated.

getSensesAddressedCount

public int getSensesAddressedCount()
Returns a count of the number of senses with a score>0

Returns:
The count of the number of addressed senses

isCorrectSenseAddressed

public boolean isCorrectSenseAddressed()
Returns true, if an algorithm answer are among the correct answers.

Returns:
True, if an algorithm answer are among the correct answers.

isTied

public boolean isTied()
Returns true, if the algorithm returned more than one correct answer.

Returns:
True, if the algorithm returned more than one correct answer.

unTie

public void unTie(Decision tie)
Solves a tie with the answer provided by another disambiguation approach.

Parameters:
tie - answer provided by another disambiguation approach.

getScore

public double getScore()
Calculates this decision's score following the Senseval score system.

Returns:
The score obtained by the system answers (it ranges in [0.0,1.0]).

isCorrect

public boolean isCorrect(int answer)
Returns true if answer is among the correct senses.

Parameters:
answer - Answer to be checked.
Returns:
True if answer is among the correct senses.

getAnswersString

public java.lang.String getAnswersString()
Returns "( [answer1 [,answerN]*]* )".

Returns:
"( [answer1 [,answerN]*]* )".