private Word.Polarity getNearestNeighbour(ArrayList<Score> scores) {
        Word.Polarity polarity = Word.Polarity.UNKNOWN;
        int numPositive = 0, numNegative = 0, numNeutral = 0, numUnknown = 0;

        // Make sure k value is not greater than number of scores
        int limit = scores.size();
        if (k < scores.size()) {
            limit = k;
        }

        for (int i=0; i<limit; ++i) {
            Score s = scores.get(i);

            if (s.polarity == Word.Polarity.POSITIVE){
                ++numPositive;
            }
            else if (s.polarity == Word.Polarity.NEGATIVE){
                ++numNegative;
            }
            else if (s.polarity == Word.Polarity.NEUTRAL){
                ++numNeutral;
            }
            else{ // Unknown
                ++numUnknown;
            }
        }

        int majority = Math.max(Math.max(Math.max(numNegative, numPositive), numNeutral), numUnknown);

        // Pick the most frequent polarity
        if (numPositive == majority){
            polarity = Word.Polarity.POSITIVE;
        }
        else if (numNegative == majority){
            polarity = Word.Polarity.NEGATIVE;
        }
        else if (numNeutral == majority){
            polarity = Word.Polarity.NEUTRAL;
        }
        else if (numUnknown == majority){
            polarity = Word.Polarity.UNKNOWN;
        }

        DecimalFormat df = new DecimalFormat("0.0#");

        System.out.println("Positive: " + df.format(numPositive/(double) k) + ", Neutral: " + df.format(numNeutral/(double) k) +
            ", Negative " + df.format(numNegative/(double) k) + ", Unknown " + df.format(numUnknown/(double) k));

        System.out.println("Match: " + df.format(majority/(double) k) + " (" + majority + "/" + k + ")");

        return polarity;
    }