@Test public void testSplit() { System.out.println("split"); String text = "THE BIG RIPOFF\n\n" + "Mr. John B. Smith bought cheapsite.com for 1.5 million dollars,\n\r" + "i.e. he paid far too much for it.\n\n" + "Did he mind?\n\r" + " \t \n" + "Adam Jones Jr. thinks he didn't. \n\r\n" + "......\n" + "In any case, this isn't true... Well, with a probability of .9 it isn't. "; String[] expResult = { "THE BIG RIPOFF", "Mr. John B. Smith bought cheapsite.com for 1.5 million dollars,\n\ri.e. he paid far too much for it.", "Did he mind?", "Adam Jones Jr. thinks he didn't. ", "......\nIn any case, this isn't true... Well, with a probability of .9 it isn't. " }; SimpleParagraphSplitter instance = SimpleParagraphSplitter.getInstance(); String[] result = instance.split(text); assertEquals(expResult.length, result.length); for (int i = 0; i < result.length; i++) assertEquals(expResult[i], result[i]); }
@Override public String[] split(String text) { Matcher matcher = REGEX_BLANK_LINE.matcher(text); text = matcher.replaceAll(""); return REGEX_PARAGRAPH.split(text); }
SimpleParagraphSplitter implements ParagraphSplitter { @Override public String[] split(String text) { Matcher matcher = REGEX_BLANK_LINE.matcher(text); text = matcher.replaceAll(""); return REGEX_PARAGRAPH.split(text); } }
SimpleParagraphSplitter implements ParagraphSplitter { @Override public String[] split(String text) { Matcher matcher = REGEX_BLANK_LINE.matcher(text); text = matcher.replaceAll(""); return REGEX_PARAGRAPH.split(text); } private  SimpleParagraphSplitter(); }
SimpleParagraphSplitter implements ParagraphSplitter { @Override public String[] split(String text) { Matcher matcher = REGEX_BLANK_LINE.matcher(text); text = matcher.replaceAll(""); return REGEX_PARAGRAPH.split(text); } private  SimpleParagraphSplitter(); static SimpleParagraphSplitter getInstance(); @Override String[] split(String text); }
SimpleParagraphSplitter implements ParagraphSplitter { @Override public String[] split(String text) { Matcher matcher = REGEX_BLANK_LINE.matcher(text); text = matcher.replaceAll(""); return REGEX_PARAGRAPH.split(text); } private  SimpleParagraphSplitter(); static SimpleParagraphSplitter getInstance(); @Override String[] split(String text);  }