public static HashMap<String, TreeMap<Double, String>> eParamsCalculator(
			String fileName) throws IOException {

		HashMap<String, TreeMap<Double, String>> emissionParams = new HashMap<String, TreeMap<Double, String>>();
		FileReader in = new FileReader(fileName);
		BufferedReader br = new BufferedReader(in);

		HashMap<String, Integer> tagCounts = new HashMap<String, Integer>();
		HashMap<String, HashMap<String, Integer>> wordToTagCount = new HashMap<String, HashMap<String, Integer>>();

		String input;
		String wordTag;
		String currentTag;
		String currentWord;

		StringTokenizer stk;
		while ((input = br.readLine()) != null) {

			stk = new StringTokenizer(input);
			int currentWordCount = Integer.parseInt(stk.nextToken());
			int currentTagCount = currentWordCount;
			wordTag = stk.nextToken();

			// System.out.println(input);
			if (wordTag.equals("WORDTAG")) {
				currentTag = stk.nextToken();
				currentWord = stk.nextToken();

				// Update tag counts
				if (tagCounts.containsKey(currentTag)) {
					currentTagCount += tagCounts.get(currentTag).intValue();
				}
				tagCounts.put(currentTag, new Integer(currentTagCount));

				// Update count for this word-tag combo
				if (!wordToTagCount.containsKey(currentWord)) {
					wordToTagCount.put(currentWord,
							new HashMap<String, Integer>());
				}
				wordToTagCount.get(currentWord).put(currentTag,
						new Integer(currentWordCount));
			}
		}

		for (String word : wordToTagCount.keySet()) {
			HashMap<String, Integer> currentMap = wordToTagCount.get(word);

			for (String tag : currentMap.keySet()) {
				int wordWithTagCount = currentMap.get(tag).intValue();
				int tagCount = tagCounts.get(tag).intValue();

				double currentEParam = ((double) wordWithTagCount) / tagCount;
				if (!emissionParams.containsKey(word)) {
					emissionParams.put(word, new TreeMap<Double, String>());
				}
				emissionParams.get(word).put(new Double(currentEParam), tag);
			}
		}

		for (String word : emissionParams.keySet()) {
			TreeMap<Double, String> currentTreeMap = emissionParams.get(word);
			for (Double d : currentTreeMap.keySet()) {
				// System.out.println(word + " " + currentTreeMap.get(d) + " "
				// + d.doubleValue());
			}
		}

		return emissionParams;
	}