### Question:
DictionaryTagger implements Tagger { public DictionaryTagger(Set<String> dictionary) { this(dictionary, StringUtils.EMPTY); } DictionaryTagger(Set<String> dictionary);  DictionaryTagger(Set<String> dictionary, String tagName);  DictionaryTagger(Map<String, String> dictionary, boolean caseSensitive); @Override List<Annotation> getAnnotations(String text); @Override String toString();  }### Answer:
@Test public void testDictionaryTagger() { Set<String> dictionary = new HashSet<>(Arrays.asList("cat", "fat", "grey cat")); String text = "Cat. The grey cat is very fat. A catfish is not a feline."; Tagger tagger = new DictionaryTagger(dictionary); List<? extends Annotation> annotations = tagger.getAnnotations(text); assertEquals(3, annotations.size()); assertEquals(new ImmutableAnnotation(0, "Cat"), annotations.get(0)); assertEquals(new ImmutableAnnotation(9, "grey cat"), annotations.get(1)); assertEquals(new ImmutableAnnotation(26, "fat"), annotations.get(2)); text = "Obama created the White House Council on Women and Girls."; Map<String, String> dicionaryMap = new HashMap<>(); dicionaryMap.put("White House Council on Women and Girls", "ORG"); dicionaryMap.put("White House", "LOC"); tagger = new DictionaryTagger(dicionaryMap, false); annotations = tagger.getAnnotations(text); assertEquals(1, annotations.size()); assertEquals(new ImmutableAnnotation(18, "White House Council on Women and Girls"), annotations.get(0)); }