"); + +for (Token token : tokens) { + if (token.isMatch()) { + html.append(""); + } + html.append(token.getFragment()); + if (token.isMatch()) { + html.append(""); + } +} + +html.append("
"); +System.out.println(html); +``` + +You can also emit custom outputs. This might for example be useful to +implement a trivial named entity recognizer. In this case use a +`PayloadTrie` instead of a `Trie` as follows: + +```java +class Word { + private final String gender; + public Word(String gender) { + this.gender = gender; + } +} + +PayloadTrie