我需要包含语句将字符串分割,如:使用正则表达式正则表达式将字符串分割成句子
"this is a sentence. this is another. Rawlings, G. stated foo and bar."
到
["this is a sentence.", "this is another.", "Rawlings, G. stated foo and bar."]
。
我发现的其他解决方案将第三句分成"Rawlings, G."
和"stated foo and bar."
这不是我想要的。
检查,如果前一个字符是不是一个大写字母 – jhamon 2014-12-02 13:35:16
检查。\。\ S {2} VS \。原因是一段时间后句子以2个空格结束,但G.只有一个空格。 – 2014-12-02 13:39:42
http://docs.oracle.com/javase/7/docs/api/java/text/BreakIterator.html#getSentenceInstance()自Java 1.0以来 – Holger 2014-12-02 13:47:31