現在我有以下代碼:用於SentenceDetector的Opennlp 1.5?
SentenceModel sd_model = null;
try {
sd_model = new SentenceModel(new FileInputStream(
"opennlp/models/english/sentdetect/en-sent.bin"));
} catch (InvalidFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SentenceDetectorME mSD = new SentenceDetectorME(sd_model);
String param = "This is a good senttence.I'm very happy. Who can tell me the truth.And go to school.";
String[] sents = mSD.sentDetect(param);
for(String sent : sents){
System.out.println(sent);
}
但我得到的follwing結果:
This is a good senttence.I'm very happy.
Who can tell me the truth.And go to school.
當然,這不是我們想要的。我該如何解決這個問題?感謝名單。
opennlp.tools.lang.english.SentenceDetector有同樣的問題。 – 2010-09-29 12:32:10