Home Coding » Writing » Photography »




Tokenizing strings into its constituent words/tokens can prove tricky for non-trivial examples. In particular, when dealing with natural language, you must take into consideration punctuation too in order to isolate the words. The jTokenizer package was designed to combine a set of tokenizers that range from basic whitespace tokenizers to more complex ones that deal intuitively with natural language.

Each of the tokenizers adopt a similar structure to java.util.StringTokenizer in terms of how to instantiate the classes and extract the tokens. This means they are simple to use, especially to those already familiar with Java's StringTokenizer.


jTokenizer comprises of six tokenizers that all extend from an abstract Tokenizer class:

jTokenizer GUI

jTokenizer also bundles a GUI. You can type in, copy and paste, or even load a text file into the application. You must select your tokenizer of choice (and any options of interest) and then hit the Tokenize button. Your results will be displayed as soon as they are processed and you have the option to save the results to file, if you choose.

The GUI is particularly useful for experimenting with tokenization methods in a teaching environment (such as an NLP course). It will also be of interest to those wishing to use the jTokenizer library but don't have the Java programming experience to utilise the code directly.