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

54
LINES

< > BotCompany Repo | #1004159 // Linked Text Experiment (dev.)

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

Transpiled version (1266L) is out of date.

!752

sclass Token {
  int originalIndex;
  S t;
  new L<Token> pointers;
  
  *() {}
  *(int *originalIndex, S *t) {}
}

sclass Ptr {
  int from, to; // token indices
  
  *() {}
  *(int *from, int *to) {}
  
  public S toString() {
    ret from + " -> " + to + " (" + quote(get(tok, from)) + "/" + quote(get(tok, to)) + ")";
  }
}

static L<S> tok;
static new L<Token> tokens;
static new L<Ptr> pointers;
static new HashMap<Int, S> stringDefs;

p {
  S text = [[
    consider the string "abc"
    what is the string's length?
  ]];
  tok = nlTok3(text);
  printStructure(codeTokens(tok));
  
  for (int i = 1; i < l(tok); i += 2)
    tokens.add(new Token(i, tok.get(i)));
  
  for (int i : jfindAll(tok, "the string <quoted>")) {
    S s = get(tok, i+4);
    if (isProperlyQuoted(s))
      print("String found: " + s);
    stringDefs.put(i+2, unquote(s));
  }
  
  for (int 
  
  pointers.add(new Ptr(
    indexOfOccurrence(tok, "string", 1),
    indexOfOccurrence(tok, "string", 0)));
  printAll(pointers);
  
  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004159
Snippet name: Linked Text Experiment (dev.)
Eternal ID of this version: #1004159/1
Text MD5: 8cc9d466a5efcbcb122acda40d8c44b3
Author: stefan
Category: javax / natural language processing
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-08 17:47:00
Source code size: 1070 bytes / 54 lines
Pitched / IR pitched: No / No
Views / Downloads: 514 / 570
Referenced in: [show references]