How can I get the noun phrase without space as input sentence after parsing with parseLine in OpenNLP?

78 views Asked by At

I am using Parse[] parses = parseLine(sentence, parser, tokenizer, numParses) in OpenNLP to get noun phrases of the sentence. parseLine preprocess the sentences to tokenize brackets and parantheses by appending with a space.

Let’s say input sentence containing paranthesis as below:

sentence= "This is an example sentence (example).";

After parsing, an example sentence (example) becomes an example sentence ( example ).

How can I get the original noun phrase instead of one by appending with a space after parsing by using its Parse object?

0

There are 0 answers