class PhraseProbabilityCalculator {

    public double getProbability(String phrase) {
        String[] tokens = phrase.split("\\s");
        String stem = stem(tokens[0].toLowerCase());
        double probability = matrix.getProbability(stem, true);
        double phraseProbability = Math.log10(probability);
        for (int i = 0; i <= tokens.length - 2; i++) {
            String first = stem(tokens[i].toLowerCase());
            String second = stem(tokens[i + 1].toLowerCase());
            double bigramProbability = matrix.getConditionalProbability(second, first, true);
            phraseProbability += Math.log10(bigramProbability);
        }
        // System.out.println(phrase + " : " + phraseProbability);
        return phraseProbability;
    }

    public  PhraseProbabilityCalculator(File matrixFile, Language language);
    public  PhraseProbabilityCalculator(CooccurrenceMatrix matrix, Language language);

}