For simple usage, with the default tokenizer and default tokenizer options for a grammar, there is an easy convenience method you can use:
lp.parse(String)
But the PTBTokenizer
methods that you point at don't take a FileReader
, they just take a Reader
, so you can also easily point a PTBTokenizer
at a String by wrapping the String in a StringReader
. This is the right approach if you need more control over how tokenization happens.