Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

36
LINES

< > BotCompany Repo | #1008408 // Try segmenting text [dev.]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2151L/14K/49K).

!7

p {
  S text = loadSnippet(#1008407);
  for (S line : toLinesFullTrim(text)) {
    if (line.startsWith("#")) continue;
    //print(line);
    printWithRisingIndent(split3(line));
  }
}

static L<S> split1(S s) {
  int i = 0;
  new L<S> l;
  while (i <= l(s)) {
    int j = smartIndexOf(s, ".", i)+1;
    addIfNempty(l, trim(substring(s, i, j)));
    i = j;
  }
  ret l;
}

static L<S> split2x(L<S> s) {
  int i = 0;
  new L<S> 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<S> split3(S s) {
  ret split2x(nlTok3(s));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008408
Snippet name: Try segmenting text [dev.]
Eternal ID of this version: #1008408/7
Text MD5: a74da88dcba9c5838491eb64b1ebf7a4
Transpilation MD5: 13df93f4cb1388f28dc01c6cb5d7cd35
Author: stefan
Category: javax / a.i. parsing
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-15 00:37:16
Source code size: 660 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 624 / 706
Version history: 6 change(s)
Referenced in: #1008419 - Try segmenting text, show form through webserver [works, but doesn't save user input]