Parse sentence Stanford Parser by passing String not an array of strings

前端 未结 1 1407
时光说笑
时光说笑 2020-12-22 04:39

Is it possible to parse a sentence using the Stanford Parser by passing a string and not an array of strings. This is the example they gave in their short tutorial (See Docs

相关标签:
1条回答
  • 2020-12-22 05:06

    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.

    0 讨论(0)
提交回复
热议问题