docs: public double getProbability(String str) {
  
  		double score = 0;	
  		String[] toks = str.split("\\s+");
  		if(toks.length<n-1)
  			return 0.0;
  		LinkedList<Integer> n1gramList = new LinkedList<Integer>();
  		int i=0;
  		n1gramList.add(-1);
  		for(;i<n-1;i++){
  			int idx = wordDict.lookupIndex(toks[i]);
  			n1gramList.add(idx);
  		}
  		for(;i<toks.length;i++){
  			int idx = wordDict.lookupIndex(toks[i]);
  			n1gramList.add(idx);
  			n1gramList.remove();
  			assert n1gramList.size()==n;
  			
  			String[] grams = getNgram(n1gramList);
  			String n1gram = grams[0];
  			String ngram = grams[1];
  			
  			double s=0;
  			int n1gramidx = n1gramDict.lookupIndex(n1gram);
  			if(n1gramidx !=-1){						
  				int ngramidx = ngramDict.lookupIndex(ngram);
  				if(ngramidx ==-1)
  					s = 1.0/(n1gramCount.get(n1gramidx)+wordDict.size());
  				else
  					s = prob.get(ngramidx);
  			}
  			score+=Math.log(s);			
  		}
  		return score;
  	}