POSDictionary implements Iterable<String>, MutableTagDictionary { public String[] getTags(String word) { if (caseSensitive) { return dictionary.get(word); } else { return dictionary.get(word.toLowerCase()); } } POSDictionary();  POSDictionary(boolean caseSensitive); @Deprecated  POSDictionary(String file); @Deprecated  POSDictionary(String file, boolean caseSensitive); @Deprecated  POSDictionary(String file, String encoding, boolean caseSensitive); @Deprecated  POSDictionary(BufferedReader reader, boolean caseSensitive); String[] getTags(String word); Iterator<String> iterator(); void serialize(OutputStream out); @Override boolean equals(Object o); @Override String toString(); static POSDictionary create(InputStream in); String[] put(String word, String... tags); boolean isCaseSensitive();  }
@Test public void testCaseInsensitiveDictionary() throws IOException { POSDictionary dict = loadDictionary("TagDictionaryCaseInsensitive.xml"); assertArrayEquals(new String[]{"NNP"}, dict.getTags("McKinsey")); assertArrayEquals(new String[]{"NNP"}, dict.getTags("Mckinsey")); assertArrayEquals(new String[]{"NNP"}, dict.getTags("MCKINSEY")); assertArrayEquals(new String[]{"NNP"}, dict.getTags("mckinsey")); dict = serializeDeserializeDict(dict); assertArrayEquals(new String[]{"NNP"}, dict.getTags("McKinsey")); assertArrayEquals(new String[]{"NNP"}, dict.getTags("Mckinsey")); }
@Test public void testLoadingDictionaryWithoutCaseAttribute() throws IOException { POSDictionary dict = loadDictionary("TagDictionaryWithoutCaseAttribute.xml"); assertArrayEquals(new String[]{"NNP"}, dict.getTags("McKinsey")); assertNull(dict.getTags("Mckinsey")); }
@Test public void testCaseSensitiveDictionary() throws IOException { POSDictionary dict = loadDictionary("TagDictionaryCaseSensitive.xml"); assertArrayEquals(new String[]{"NNP"}, dict.getTags("McKinsey")); assertNull(dict.getTags("Mckinsey")); dict = serializeDeserializeDict(dict); assertArrayEquals(new String[]{"NNP"}, dict.getTags("McKinsey")); assertNull(dict.getTags("Mckinsey")); }