### Question:
NgramModel implements Serializable { protected double prob(String s) { double result; if (s.charAt(0) == BOS) { result = occurrences(String.valueOf(BOS) + lastChar(s)) / (double) sampleSize(); } else if (!occur.containsKey(s)) { result = 0; } else { result = occurrences(s) / (double) occurrences(head(s)); } return result; } NgramModel(int order);  NgramModel(File file); int size(); void save(File file); double[] getGoodTuringPars(); int occurrences(String key); void addWord(String word); void addWords(File file, Charset encoding, boolean caseSensitive); double logWordProb(String word); double logPerWordLikelihood(boolean caseSensitive); void addText(InputStream is); double logLikelihood(InputStream is, int contextLength); double logLikelihood(String context, String input); double logProb(String context, char c); @Override String toString(); void showDiff(NgramModel other); boolean equals(NgramModel other); @Override boolean equals(Object o); @Override int hashCode(); static void main(String[] args);  }### Answer:
@Test public void testProb() { System.out.println("prob"); NgramModel ngrams = new NgramModel(3); ngrams.addWord("0000"); ngrams.addWord("0100"); assertEquals(4 / (double) 7, ngrams.prob("00"), 0.001); assertEquals(0.7, ngrams.prob("0"), 0.001); }