I am trying tokenize strings into ngrams. Strangely in the documentation for the NGramTokenizer I do not see a method that will return the individual ngrams that were tokenized. In fact I only see two methods in the NGramTokenizer class that return String Objects.
Here is the code that I have:
Reader reader = new StringReader("This is a test string");
NGramTokenizer gramTokenizer = new NGramTokenizer(reader, 1, 3);
- Where are the ngrams that were tokenized?
- How can I get the output in Strings/Words?
I want my output to be like: This, is, a, test, string, This is, is a, a test, test string, This is a, is a test, a test string.