I need to use the Java-based OpenNLP library in my PHP code. For example, I need to use the Sentence Detector component (en-sent.bin) to parse text variables in my PHP code.
In the documentation, this API can be obtained from Java code as follows:
InputStream modelIn = new FileInputStream("en-sent.bin"); try { SentenceModel model = new SentenceModel(modelIn); } catch (IOException e) { e.printStackTrace(); } finally { if (modelIn != null) { try { modelIn.close(); } catch (IOException e) { } } }
How to do the same in PHP?
In other words, what is the PHP equivalent of the above Java code?
Orion source share