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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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