!7 static new L data; p { S text = loadSnippet(#1008407); data.clear(); new HashSet paragraphSet; for (S line : toLinesFullTrim(text)) { if (line.startsWith("#")) continue; if (!paragraphSet.add(line)) continue; //print(line); L split = split3(line); printWithRisingIndent(split); S sp; if (l(split) == 1 && eq(first(split), line)) sp = "-"; else sp = htmlEncode_nlToBr(lines(split)); data.add(litorderedmap( "Original Paragraph" := htmlencode(line), "Split" := sp, "OK" := hcheckbox(lstr(data), false, "class" := "chkbox"))); } data = sortByCalculatedField(data, func(Map m) { neq(m.get("Split"), "-") }); serveHttpOpenBrowser(4000); } static NanoHTTPD.Response serve(S uri, NanoHTTPD.Method method, Map header, Map parms, Map files) { S title = "Splitting paragraphs into sentences"; ret serveHTML(hhtml( hhead(htitle(title) + loadJQuery() + hCheckBoxMultiSelect()) + hbody(h3(title) + hform(htable_noEncode(data) + p(hsubmit()))))); } static L split1(S s) { int i = 0; new L l; while (i <= l(s)) { int j = smartIndexOf(s, ".", i)+1; addIfNempty(l, trim(substring(s, i, j))); i = j; } ret l; } static L split2x(L s) { int i = 0; new L l; while (i <= l(s)) { int j = smartIndexOf(s, ".", i)+1; addIfNempty(l, trim(join(subList(s, i, j)))); i = j; } ret l; } static L split3(S s) { ret split2x(nlTok3(s)); }