请问用java怎么把一篇英文文档拆分成句子,并且计算每个句子在原文档的起始和结束位置呢?
我试过standford parser,但是用了这个很难计算句子在原来文档的起始和结束位置。请各位大侠指教。感激不尽。

解决方案 »

  1.   

    str.split(".");
    按句号截取 就行了吧 
      

  2.   

    String text = "Working from home takes discipline.  If you’re just starting out, it may take you a little time to find your groove, but if you follow the tips above you’ll find it a lot easier.  The key is to keep a good work-life balance, establish boundaries, and take care of yourself.";BreakIterator bi = BreakIterator.getSentenceInstance(Locale.ENGLISH);
    bi.setText(text);
    for (int start = bi.first(),end=bi.next(); end != BreakIterator.DONE; start = end, end = bi.next()) {
        System.out.println(text.substring(start,end));
    }