Transpiled version (1266L) is out of date.
1 | !752 |
2 | |
3 | sclass Token { |
4 | int originalIndex; |
5 | S t; |
6 | new L<Token> pointers; |
7 | |
8 | *() {} |
9 | *(int *originalIndex, S *t) {} |
10 | } |
11 | |
12 | sclass Ptr { |
13 | int from, to; // token indices |
14 | |
15 | *() {} |
16 | *(int *from, int *to) {} |
17 | |
18 | public S toString() { |
19 | ret from + " -> " + to + " (" + quote(get(tok, from)) + "/" + quote(get(tok, to)) + ")"; |
20 | } |
21 | } |
22 | |
23 | static L<S> tok; |
24 | static new L<Token> tokens; |
25 | static new L<Ptr> pointers; |
26 | static new HashMap<Int, S> stringDefs; |
27 | |
28 | p { |
29 | S text = [[ |
30 | consider the string "abc" |
31 | what is the string's length? |
32 | ]]; |
33 | tok = nlTok3(text); |
34 | printStructure(codeTokens(tok)); |
35 | |
36 | for (int i = 1; i < l(tok); i += 2) |
37 | tokens.add(new Token(i, tok.get(i))); |
38 | |
39 | for (int i : jfindAll(tok, "the string <quoted>")) { |
40 | S s = get(tok, i+4); |
41 | if (isProperlyQuoted(s)) |
42 | print("String found: " + s); |
43 | stringDefs.put(i+2, unquote(s)); |
44 | } |
45 | |
46 | for (int |
47 | |
48 | pointers.add(new Ptr( |
49 | indexOfOccurrence(tok, "string", 1), |
50 | indexOfOccurrence(tok, "string", 0))); |
51 | printAll(pointers); |
52 | |
53 | |
54 | } |
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: | 528 / 588 |
Referenced in: | [show references] |