tokens = trie.tokenize(speech);
-StringBuilder html = new StringBuilder();
-html.append("");
-
-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 trie = PayloadTrie.builder()
- .addKeyword("hers", new Word("f")
- .addKeyword("his", new Word("m"))
- .addKeyword("she", new Word("f"))
- .addKeyword("he", new Word("m"))
- .addKeyword("nonbinary", new Word("nb"))
- .addKeyword("transgender", new Word("tg"))
- .build();
-Collection> emits = trie.parseText("ushers");
-```
-
-Releases
---------
-
-See [releases](https://github.com/robert-bor/aho-corasick/releases) for details.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.