public void loadDictionary(Reader stream){
		BufferedReader br = new BufferedReader(stream);
		HashMap<String, WordClass> str2class = new HashMap<String, WordGrouper.WordClass>();
		str2class.put("L", WordClass.PrefixSmallWord);
		str2class.put("R", WordClass.PostfixSmallWord);
		str2class.put("S", WordClass.SmallWord);
		str2class.put("G", WordClass.GeneralWord);
		str2class.put("P", WordClass.Punctuation);
		try {
			do{
				String line = br.readLine();
				if (line == null) break;
				if (line.isEmpty() || line.startsWith("#"))
					continue;
				int separatorPos = line.lastIndexOf('\t');
				if (separatorPos == -1) throw new RuntimeException("Dictionary format error: no tab");
				String word = line.substring(0, separatorPos);
				WordClass klass = str2class.get(line.substring(separatorPos+1));
				assert klass != null;
				if (klass != WordClass.Punctuation){
					dictionary.put(word, klass);
				}else{
					assert word.length() == 1;
					punctuation.add(word.charAt(0));
				}
			}while(true);
			br.close();
		}catch (IOException e) {
			throw new RuntimeException(e);
		} 
	}