Menu

Allow models as InputStream

Developers
codyco
2010-05-09
2013-04-16
  • codyco

    codyco - 2010-05-09

    There are situations when it is quite hard to access the file path of a model and pass it to an OpenNLP object (like SentenceDetector). For example when the model is inside an OSGi bundle. So I would recommend to also allow InputStreams. For example SentenceDetector(InputStream modelStream).

    Best regards,
    Kai

     
  • Joern Kottmann

    Joern Kottmann - 2010-05-11

    Sorry for the late reply.

    It should be possible to create most of the components from InputStreams instead of files,
    usually they have a constructor which takes a MaxentModel as parameter and the
    MaxentModel can be created from an InputStream like this:

    new BinaryGISModelReader(new DataInputStream(new GZIPInputStream(resource.getInputStream()))).getModel();

    Hope that helps,
    Jörn

     

Log in to post a comment.