/** * update language probabilities with N-gram string(N=1,2,3) * @param word N-gram string */ private boolean updateLangProb(double[] prob, String word, double alpha) { if (word == null || !wordLangProbMap.containsKey(word)) return false; double[] langProbMap = wordLangProbMap.get(word); if (verbose) System.out.println(word + "(" + unicodeEncode(word) + "):" + wordProbToString(langProbMap)); double weight = alpha / BASE_FREQ; for (int i=0;i<prob.length;++i) { prob[i] *= weight + langProbMap[i]; } return true; }