private static void piFiller(ArrayList<String> sentenceArrayList,
			HashMap<Integer, HashMap<String, Double>> piValues, String countFile)
			throws IOException {

		HashMap<String, TreeMap<Double, String>> emissionParams = HMMHelpers
				.eParamsCalculator(countFile);

		HashMap<String, Integer> nGramMap = HMMHelpers
				.nGramMapper(countFile);

		HashMap<String, Integer> wordToCount = HMMHelpers.rareWordMarker(
				"ner_0.counts", "ner_train.dat");

		HashMap<String, Double> map = new HashMap<String, Double>();
		map.put("* *", new Double(1));
		piValues.put(new Integer(0), map);

		String w = "";
		String u = "";
		String v = "";
		String currentWord = "";
		String prevWord = "";
		String prevPrevWord = "";
		double bPiValue;

		for (int i = 1; i <= sentenceArrayList.size(); i++) {
			currentWord = sentenceArrayList.get(i - 1);
			map = new HashMap<String, Double>();

			if (!wordToCount.containsKey(currentWord)) {
				currentWord = "_RARE_";
			} else if (wordToCount.get(currentWord) < 5) {
				currentWord = "_RARE_";
			}

			for (Double v1 : emissionParams.get(currentWord).keySet()) {

				v = emissionParams.get(currentWord).get(v1);
				if (!prevWord.equals("")) {
					for (Double v2 : emissionParams.get(prevWord).keySet()) {
						u = emissionParams.get(prevWord).get(v2);
						String bigram = u + " " + v;
						bPiValue = 0.0;

						// If second word in the sentence
						if (prevPrevWord.equals("")) {
							w = "*";
							bPiValue = piValues.get(new Integer(i - 1))
									.get(w + " " + u).doubleValue()
									* HMMHelpers.qParam(w, u, v, nGramMap) * v1;
						} // Else if word 3...n in the sentence
						else {
							bPiValue = 0.0;
							double max;
							for (Double v3 : emissionParams.get(prevPrevWord)
									.keySet()) {
								w = emissionParams.get(prevPrevWord).get(v3);
								max = piValues.get(new Integer(i - 1))
										.get(w + " " + u).doubleValue()
										* HMMHelpers.qParam(w, u, v, nGramMap)
										* v1;
								if (max > bPiValue) {
									bPiValue = max;
								}
							}
						}
						map.put(bigram, bPiValue);
						piValues.put(new Integer(i), map);
					}
					// Else - first word in the sentence
				} else {
					u = "*";
					w = "*";
					String bigram = u + " " + v;
					bPiValue = piValues.get(new Integer(i - 1))
							.get(w + " " + u).doubleValue()
							* HMMHelpers.qParam(w, u, v, nGramMap) * v1;
					map.put(bigram, bPiValue);
					piValues.put(new Integer(i), map);
				}
			}

			prevPrevWord = prevWord;
			prevWord = currentWord;
		}
	}