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

17
LINES

< > BotCompany Repo | #1025689 // test_PositionalTokenIndex [OK]

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

Libraryless. Click here for Pure Java version (4509L/29K).

static PositionalTokenIndex test_PositionalTokenIndex() {
  new PositionalTokenIndex idx;
  idx.addAll(map wordTok(tlft([[
    you are here
    what is this
    hello world
    hello you
  ]])));
  printStruct(idx);
  assertEqualsVerbose(ll("you are here"), map join(idx.byToken(0, "you")));
  // index should preserve original order
  assertEqualsVerbose(ll("hello world", "hello you"), map join(idx.byToken(0, "hello")));
  assertEqualsVerbose(ll("what is this"), map join(idx.byToken(1, "is")));
  assertEqualsVerbose(ll(), unnull(map join(idx.byToken(3, "is"))));
  stresstest_PositionalTokenIndex();
  ret idx;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025689
Snippet name: test_PositionalTokenIndex [OK]
Eternal ID of this version: #1025689/6
Text MD5: 328b270c068420defeb81267141462af
Transpilation MD5: 06c8d2dfc491c6bad17b683bbdde9a26
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-13 22:23:04
Source code size: 633 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 208 / 344
Version history: 5 change(s)
Referenced in: [show references]