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

35
LINES

< > BotCompany Repo | #1017686 // English Parse Tree v3 with curly phrases [OK]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (13642L/76K).

1  
!7
2  
3  
cmodule BottomUpParser > DynSCP/*WithInput*/ {
4  
  transient S lastOutput;
5  
  transient PTElement root;
6  
  transient ReliableSingleThread rstUpdate;
7  
  
8  
  visual withCenteredButtons(super,
9  
    "Good Parse", rThread { addToMechList_noUniq("Good english parses", "\n" + ai_renderCulledParseTree(root)) });
10  
  
11  
  start {
12  
    set flag DynModule. // for transpilation
13  
    rstUpdate = dm_rst(module(), r update);
14  
    dm_useLocallyCopiedMechLists(); set flag NoFancyMechParsing.
15  
    ai_parser_activateStandardFunctions();
16  
    dm_onTopInputChanged(rstUpdate);
17  
    doEvery(5000, r { if (dm_isShowingAndOSInForeground()) rstUpdate.trigger(); });
18  
  }
19  
  
20  
  void update() enter {
21  
    //if (!isShowing()) { inputChooser.forgetInput(); ret; }
22  
    S s = dm_topInput(); //inputChooser.input();
23  
    
24  
    root = ai_parseToTreeWithCurlyPhrases(s);
25  
    
26  
    S rendered = ai_renderParseTree(root);
27  
    bool shouldVis = neq(rendered, lastOutput);
28  
    lastOutput = rendered;
29  
    if (shouldVis) {
30  
      JTree tree = jDynamicTree(root, func(final PTElement e) -> L<PTElement> { e == null ? null : e.children });
31  
      setComponent(tree);
32  
      ai_openMainParseInJTree(tree);
33  
    }
34  
  }
35  
}

Author comment

Began life as a copy of #1017472

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017686
Snippet name: English Parse Tree v3 with curly phrases [OK]
Eternal ID of this version: #1017686/5
Text MD5: 3daae190c84ed1dab3a1f0e98400001a
Transpilation MD5: 3aeb6f8283982d55980b84b4f77dbac7
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-09 14:15:22
Source code size: 1192 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 491 / 3329
Version history: 4 change(s)
Referenced in: [show references]