Libraryless. Click here for Pure Java version (2454L/15K).
1 | static L<S> splitIntoSentences_v2(S s, O... _) {
|
2 | ret splitIntoSentences_v2_tok(nlTok3(s), _); |
3 | } |
4 | |
5 | static Cl<S> splitIntoSentences_v2_tok_endMarkers = litset(".", "?", "!");
|
6 | |
7 | static L<S> splitIntoSentences_v2_tok(L<S> s, O... _) {
|
8 | optPar Cl<S> endMarkers = splitIntoSentences_v2_tok_endMarkers; |
9 | int i = 0; |
10 | new L<S> l; |
11 | while (i < l(s)) {
|
12 | int j; |
13 | if (emptyAfterTrim(s.get(i)) && isRoundBracketed(get(s, i+1))) |
14 | j = i+2; |
15 | else |
16 | j = smartIndexOfAny(s, i, endMarkers)+1; |
17 | addIfNempty(l, trimJoinSubList(s, i, j)); |
18 | i = j; |
19 | } |
20 | ret l; |
21 | } |
Began life as a copy of #1008429
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1008435 |
| Snippet name: | splitIntoSentences_v2 (with questions) |
| Eternal ID of this version: | #1008435/9 |
| Text MD5: | 0b713c04a32da2ee3583da5bafe7bee5 |
| Transpilation MD5: | 9aafebc0f1dd93d12a1e8b13882d3739 |
| Author: | stefan |
| Category: | javax / parsing |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-02-23 11:03:21 |
| Source code size: | 585 bytes / 21 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 759 / 923 |
| Version history: | 8 change(s) |
| Referenced in: | [show references] |