@Test public void testTrigramMLProbability() { Collection<StringList> set = new LinkedList<>(); set.add(new StringList("<s>", "I", "am", "Sam", "</s>")); set.add(new StringList("<s>", "Sam", "I", "am", "</s>")); set.add(new StringList("<s>", "I", "do", "not", "like", "green", "eggs", "and", "ham", "</s>")); set.add(new StringList("")); Double d = NGramUtils.calculateTrigramMLProbability("I", "am", "Sam", set); Assert.assertEquals(Double.valueOf(0.5), d); d = NGramUtils.calculateTrigramMLProbability("Sam", "I", "am", set); Assert.assertEquals(Double.valueOf(1d), d); }
public static double calculateTrigramMLProbability(String x0, String x1, String x2, Iterable<StringList> set) { return calculateNgramMLProbability(new StringList(x0, x1, x2), set); }
NGramUtils { public static double calculateTrigramMLProbability(String x0, String x1, String x2, Iterable<StringList> set) { return calculateNgramMLProbability(new StringList(x0, x1, x2), set); } }
NGramUtils { public static double calculateTrigramMLProbability(String x0, String x1, String x2, Iterable<StringList> set) { return calculateNgramMLProbability(new StringList(x0, x1, x2), set); }  }
NGramUtils { public static double calculateTrigramMLProbability(String x0, String x1, String x2, Iterable<StringList> set) { return calculateNgramMLProbability(new StringList(x0, x1, x2), set); }  static double calculateLaplaceSmoothingProbability(StringList ngram,
      Iterable<StringList> set, Double k); static double calculateUnigramMLProbability(String word, Collection<StringList> set); static double calculateBigramMLProbability(String x0, String x1, Collection<StringList> set); static double calculateTrigramMLProbability(String x0, String x1, String x2,
                                                     Iterable<StringList> set); static double calculateNgramMLProbability(StringList ngram, Iterable<StringList> set); static double calculateBigramPriorSmoothingProbability(String x0, String x1,
                                                                Collection<StringList> set, Double k); static double calculateTrigramLinearInterpolationProbability(String x0, String x1,
                                                                      String x2, Collection<StringList> set,
      Double lambda1, Double lambda2, Double lambda3); static double calculateMissingNgramProbabilityMass(StringList ngram, Double discount,
                                                            Iterable<StringList> set); static StringList getNMinusOneTokenFirst(StringList ngram); static StringList getNMinusOneTokenLast(StringList ngram); static Collection<StringList> getNGrams(StringList sequence, int size); static Collection<String[]> getNGrams(String[] sequence, int size); }
NGramUtils { public static double calculateTrigramMLProbability(String x0, String x1, String x2, Iterable<StringList> set) { return calculateNgramMLProbability(new StringList(x0, x1, x2), set); }  static double calculateLaplaceSmoothingProbability(StringList ngram,
      Iterable<StringList> set, Double k); static double calculateUnigramMLProbability(String word, Collection<StringList> set); static double calculateBigramMLProbability(String x0, String x1, Collection<StringList> set); static double calculateTrigramMLProbability(String x0, String x1, String x2,
                                                     Iterable<StringList> set); static double calculateNgramMLProbability(StringList ngram, Iterable<StringList> set); static double calculateBigramPriorSmoothingProbability(String x0, String x1,
                                                                Collection<StringList> set, Double k); static double calculateTrigramLinearInterpolationProbability(String x0, String x1,
                                                                      String x2, Collection<StringList> set,
      Double lambda1, Double lambda2, Double lambda3); static double calculateMissingNgramProbabilityMass(StringList ngram, Double discount,
                                                            Iterable<StringList> set); static StringList getNMinusOneTokenFirst(StringList ngram); static StringList getNMinusOneTokenLast(StringList ngram); static Collection<StringList> getNGrams(StringList sequence, int size); static Collection<String[]> getNGrams(String[] sequence, int size);  }