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

14
LINES

< > BotCompany Repo | #1012561 // ai_groupNounPhrases

JavaX fragment (include)

static S ai_groupNounPhrases(S s) {
  L<S> tok = defaultTok(s);
  for (int i = 1; i < l(tok); ) {
    int j = ai_endOfNounPhrase(subList(tok, i-1)); // j is odd
    if (j <= 3) i += 2;
    else {
      tok.set(i, "{" + tok.get(i));
      int i2 = i+j-3;
      tok.set(i2, tok.get(i2) + "}");
      i = i2+2;
    }
  }
  ret join(tok);
}

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: #1012561
Snippet name: ai_groupNounPhrases
Eternal ID of this version: #1012561/2
Text MD5: 5ab624f4e05ab2b015fe9e5a962e4925
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-07 02:11:18
Source code size: 349 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 405 / 448
Version history: 1 change(s)
Referenced in: [show references]