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

7
LINES

< > BotCompany Repo | #1028084 - subtokenizationsOfAnyLength (OK)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2862L/18K).

// returns actual CNC
static ItIt<LS> subtokenizationsOfAnyLength(LS tok) {
  int n = countTokens(tok);
  ret nestedIterator(countIterator_inclusive(1, n), length -> // how many tokens to get
    mapI(countIterator_inclusive(0, n-length), i -> // first token to get
      subList(tok, i*2, (i+length)*2+1)));
}

download  show line numbers  debug dex   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028084
Snippet name: subtokenizationsOfAnyLength (OK)
Eternal ID of this version: #1028084/4
Text MD5: 01451105478db1fc79baac278ac2f94f
Transpilation MD5: c4fbb474dbbd16e7e97be0f286c9bdbd
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-17 16:20:34
Source code size: 316 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 35 / 68
Version history: 3 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1028084 & http://1028084.tinybrain.de