private static void evalNgram(ArrayList<String> arrayList, HashMap<String, Double> model, 
             HashMap<String, Double> lambdas){
         for(int i = 0; i < arrayList.size(); i++){
            ArrayList<String> list = PutBOSsymbol(arrayList.get(i), n);
            for(int j = n - 1 ; j < list.size(); j++){
                W += 1;
                // make ngrams
                String[] ngram = new String[n];
                int num = 0;
                ngram[num] = list.get(j);
                for(int k = 1; k < n; k++){
                    ngram[num+1] = list.get(j-num-1) + " " + ngram[num];
                    num++;
                }
                // initialized probability
                double[] P = new double[n];
                double lambda = getLambda(ngram[0], lambdas);
                P[0] = (1 - lambda) / V;
                for(int k = 1; k < n; k++){
                    lambda = getLambda(ngram[k], lambdas);
                    P[k] = (1 - lambda) * P[k-1];
                }
                
                for(int k = 0; k < n; k++){
                    if(model.containsKey(ngram[k])){
                        lambda = getLambda(ngram[0], lambdas);
                        P[k] += lambda * model.get(ngram[k]);
                        if(k != n - 1){
                            P[k+1] = (1 - lambda) * P[k];
                        }
                    }
                }
                H  = H - log2(P[n-1]);
            }
         }
         double entropy = H / W;
         println("entropy = " + entropy);
     }