public static HashMap<String, Integer> rareWordMarker(String countFile,
			String dataFile) throws IOException {

		HashMap<String, Integer> wordToCount = new HashMap<String, Integer>();

		FileReader in = new FileReader(countFile);
		BufferedReader br = new BufferedReader(in);

		StringTokenizer stk;
		String input;
		String wordTag;
		String currentWord;

		/*
		 * Compute the word counts for each word
		 */
		while ((input = br.readLine()) != null) {
			stk = new StringTokenizer(input);
			int currentWordCount = Integer.parseInt(stk.nextToken());
			wordTag = stk.nextToken();

			if (wordTag.equals("WORDTAG")) {
				// System.out.println(input);
				stk.nextToken();
				currentWord = stk.nextToken();
				if (wordToCount.containsKey(currentWord)) {
					currentWordCount += wordToCount.get(currentWord).intValue();
				}
				wordToCount.put(currentWord, currentWordCount);
			}
		}

		in = new FileReader(dataFile);
		br = new BufferedReader(in);
		String tag;
		String write;

		File rareCounts = new File("ner_train_rare.dat");
		BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(
				rareCounts));

		while ((input = br.readLine()) != null) {
			stk = new StringTokenizer(input);
			if (input.length() > 1) {
				currentWord = stk.nextToken();
				tag = stk.nextToken();
				if (wordToCount.get(currentWord).intValue() < 5) {
					currentWord = "_RARE_";
				}
				write = currentWord + " " + tag;
				// System.out.println(write);
				bufferedWriter.write(write);
				bufferedWriter.write("\n");
			} else {
				bufferedWriter.write("\n");
			}
		}
		bufferedWriter.close();

		return wordToCount;
	}