### Question:
NgramModel implements Serializable { protected double smoothProb(String s) { double result; if (s.length() > 1) { if (s.charAt(0) == BOS && s.length() > 2) { result = smoothProb(s.substring(s.length() - 2, s.length())); } else { double lam = lambda(s.length() - 1); result = (1 - lam) * prob(s) + lam * smoothProb(tail(s)); } } else { result = prob(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 testSmoothProb() { System.out.println("prob"); NgramModel ngrams = new NgramModel(3); ngrams.addWord("0000"); ngrams.addWord("0100"); double expResult = 0.8 * (4 / (double) 7) + 0.2 * 0.7; double result = ngrams.smoothProb("00"); assertEquals(expResult, result, 0.001); expResult = 0.8 * (2 / (double) 7) + 0.2 * 0.2; result = ngrams.smoothProb("0" + ngrams.EOS); assertEquals(expResult, result, 0.001); }