public static WordChoiceReport evaluate(
            SemanticSpace sspace,
            WordChoiceEvaluation test,
            Similarity.SimType vectorComparisonType) {
        Collection<MultipleChoiceQuestion> questions = test.getQuestions();
        int correct = 0;
        int unanswerable = 0;
        
        question_loop:
        // Answer each question by using the vectors from the provided Semantic
        // Space
        for (MultipleChoiceQuestion question : questions) {
            String promptWord = question.getPrompt();

            // get the vector for the prompt
            Vector promptVector = sspace.getVector(promptWord);

            // check that the s-space had the prompt word
            if (promptVector == null) {
                unanswerable++;
                continue;
            }

            int answerIndex = 0;
            double closestOption = Double.MIN_VALUE;

            // find the options whose vector has the highest similarity (or
            // equivalent comparison measure) to the prompt word.  The
            // running assumption hear is that for the value returned by the
            // comparison method, a high value implies more similar vectors.
            int optionIndex = 0;
            for (String optionWord : question.getOptions()) {
                
                // Get the vector for the option
                Vector optionVector = sspace.getVector(optionWord);
        
                // check that the s-space had the option word
                if (optionVector == null) {
                    unanswerable++;
                    continue question_loop;
                }
            
                double similarity = Similarity.getSimilarity(
                        vectorComparisonType, 
                        promptVector, optionVector);
            
                if (similarity > closestOption) {
                    answerIndex = optionIndex;
                    closestOption = similarity;
                }
                optionIndex++;
            }

            // see whether our guess matched with the correct index
            if (answerIndex == question.getCorrectAnswer()) {
                correct++;
            }
        }

        return new SimpleReport(questions.size(), correct, unanswerable);
    }
public static WordChoiceReport evaluate ( SemanticSpace sspace , WordChoiceEvaluation test , Similarity . SimType vectorComparisonType ) { Collection < MultipleChoiceQuestion > questions = test . getQuestions ( ) ; int correct = 0 ; int unanswerable = 0 ; question_loop : for ( MultipleChoiceQuestion question : questions ) { String promptWord = question . getPrompt ( ) ; Vector promptVector = sspace . getVector ( promptWord ) ; if ( promptVector == null ) { unanswerable ++ ; continue ; } int answerIndex = 0 ; double closestOption = Double . MIN_VALUE ; int optionIndex = 0 ; for ( String optionWord : question . getOptions ( ) ) { Vector optionVector = sspace . getVector ( optionWord ) ; if ( optionVector == null ) { unanswerable ++ ; continue question_loop ; } double similarity = Similarity . getSimilarity ( vectorComparisonType , promptVector , optionVector ) ; if ( similarity > closestOption ) { answerIndex = optionIndex ; closestOption = similarity ; } optionIndex ++ ; } if ( answerIndex == question . getCorrectAnswer ( ) ) { correct ++ ; } } return new SimpleReport ( questions . size ( ) , correct , unanswerable ) ; }
Evaluates the performance of a given {@code SemanticSpace} on a given
{@code WordChoiceEvaluation} using the provided similarity metric.
Returns a {@link WordChoiceReport} detailing the performance.

@param sspace The {@link SemanticSpace} to test against
@param test The {@link WordChoiceEvaluation} providing a set of multiple
choice options
@param vectorComparisonType The similarity measture to use

@return A {@link WordChoiceReport} detailing the performance