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

14
LINES

< > BotCompany Repo | #1012561 // ai_groupNounPhrases

JavaX fragment (include)

1  
static S ai_groupNounPhrases(S s) {
2  
  L<S> tok = defaultTok(s);
3  
  for (int i = 1; i < l(tok); ) {
4  
    int j = ai_endOfNounPhrase(subList(tok, i-1)); // j is odd
5  
    if (j <= 3) i += 2;
6  
    else {
7  
      tok.set(i, "{" + tok.get(i));
8  
      int i2 = i+j-3;
9  
      tok.set(i2, tok.get(i2) + "}");
10  
      i = i2+2;
11  
    }
12  
  }
13  
  ret join(tok);
14  
}

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: 406 / 449
Version history: 1 change(s)
Referenced in: [show references]