You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@opennlp.apache.org by Shilpa Pandey <pg...@iitj.ac.in> on 2013/09/10 14:12:57 UTC

Query in use of OPENNLP

Dear Sir/Madam,

I am a research scholar and is trying to use the opennlp tool but is not
able to use with net-beans.
The tool seems to be complicated as no proper tutorials are provided. I
major problem is that I have downloaded a apache-opennlp-1.5.3-bin folder
which contains bin, jars,lib etc. I even set their path in environment
variables but still when I wish to use  SentenceModel class it is showing
that it is not present.
The code is copied here.
package sp;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author shilpa
 */
public class Sp {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException {
        // TODO code application logic here
        InputStream modelIn ;
modelIn = new FileInputStream("en-token.bin");
try {
  SentenceModel model = new SentenceModel(modelIn);
}

finally {
  if (modelIn != null) {
    try {
      modelIn.close();
    }
    catch (IOException e) {
    }
  }
}
    }
}

Kindly help.
-- 
Regards
Shilpa Pandey
PhD. ICT.
**
Ability may get you to the top, but it takes character to keep you there.

Re: Query in use of OPENNLP

Posted by Jörn Kottmann <ko...@gmail.com>.
Hello,

before you can use a public class (e.g. SentenceModel) which is not part 
of your own package
you need to import it.

Its nicely explained here in the Java Tutorial:
http://docs.oracle.com/javase/tutorial/java/package/usepkgs.html

HTH,
Jörn

On 09/10/2013 02:12 PM, Shilpa Pandey wrote:
> Dear Sir/Madam,
>
> I am a research scholar and is trying to use the opennlp tool but is not
> able to use with net-beans.
> The tool seems to be complicated as no proper tutorials are provided. I
> major problem is that I have downloaded a apache-opennlp-1.5.3-bin folder
> which contains bin, jars,lib etc. I even set their path in environment
> variables but still when I wish to use  SentenceModel class it is showing
> that it is not present.
> The code is copied here.
> package sp;
>
>
> import java.io.FileInputStream;
> import java.io.FileNotFoundException;
> import java.io.IOException;
> import java.io.InputStream;
>
> /**
>   *
>   * @author shilpa
>   */
> public class Sp {
>
>      /**
>       * @param args the command line arguments
>       */
>      public static void main(String[] args) throws FileNotFoundException {
>          // TODO code application logic here
>          InputStream modelIn ;
> modelIn = new FileInputStream("en-token.bin");
> try {
>    SentenceModel model = new SentenceModel(modelIn);
> }
>
> finally {
>    if (modelIn != null) {
>      try {
>        modelIn.close();
>      }
>      catch (IOException e) {
>      }
>    }
> }
>      }
> }
>
> Kindly help.