You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@opennlp.apache.org by نوشین سادات طاهری <ta...@gmail.com> on 2016/04/06 12:48:44 UTC

help request

Hello
before starting my question, i appreciate you in advance for your support.

I am a newbie in java and opennlp, so i am truly sorry if my questions
don't make any sense in your opinion.
I want to do sth like this:
I have a XML file as an input. so first of all i want to read whole
documents and give it to my classes to do some operations. I have problem
in this part... I can read XML file with java functions but not whole of
the document... about half of them.

second, without considering about the input I wrote some code which i want
to use opennlp models. the first one is sentence detection, i wrote the
code and it works. but when i call the class in main method (the class has
to return a string[]), and I have this error:
[Ljava.lang.String;@5b2133b1


which I can't understand why. when my class is void, it hasn't any error
and works perfect.
then i need to tokenize each sentence. the input of tokenization part is
the out put of sentence detection. but i don't know how to deal with it.

I am really thankful for your responses.

Re: help request

Posted by "Russ, Daniel (NIH/CIT) [E]" <dr...@mail.nih.gov>.
This is not really an opennlp question, but more of a java question. You should consider posting this to stackoverflow (https://stackoverflow.com ), you’ll get your answer much faster.

I am guess this is a really big xml file, DOM is a notorious memory hog.  You should consider using SAX, and saving the parse result in some type of a tree structure.  The error you are getting is because you are trying to print a string array.  The default toString method for an array prints what you see, the class ([Ljava.lang.String) and the memory location (@5b2133b1).  Try something like System.out.println(Arrays.toString(arrayVariable)).

Next time, post to StackOverflow.

Hope it helps...

Daniel Russ, Ph.D.
Staff Scientist, Office of Intramural Research
Center for Information Technology
National Institutes of Health
U.S. Department of Health and Human Services
12 South Drive
Bethesda,  MD 20892-5624

On Apr 6, 2016, at 6:48 AM, نوشین سادات طاهری <ta...@gmail.com>> wrote:

Hello
before starting my question, i appreciate you in advance for your support.

I am a newbie in java and opennlp, so i am truly sorry if my questions
don't make any sense in your opinion.
I want to do sth like this:
I have a XML file as an input. so first of all i want to read whole
documents and give it to my classes to do some operations. I have problem
in this part... I can read XML file with java functions but not whole of
the document... about half of them.

second, without considering about the input I wrote some code which i want
to use opennlp models. the first one is sentence detection, i wrote the
code and it works. but when i call the class in main method (the class has
to return a string[]), and I have this error:
[Ljava.lang.String;@5b2133b1


which I can't understand why. when my class is void, it hasn't any error
and works perfect.
then i need to tokenize each sentence. the input of tokenization part is
the out put of sentence detection. but i don't know how to deal with it.

I am really thankful for your responses.