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).

!7

cmodule BottomUpParser > DynSCP/*WithInput*/ {
  transient S lastOutput;
  transient PTElement root;
  transient ReliableSingleThread rstUpdate;
  
  visual withCenteredButtons(super,
    "Good Parse", rThread { addToMechList_noUniq("Good english parses", "\n" + ai_renderCulledParseTree(root)) });
  
  start {
    set flag DynModule. // for transpilation
    rstUpdate = dm_rst(module(), r update);
    dm_useLocallyCopiedMechLists(); set flag NoFancyMechParsing.
    ai_parser_activateStandardFunctions();
    dm_onTopInputChanged(rstUpdate);
    doEvery(5000, r { if (dm_isShowingAndOSInForeground()) rstUpdate.trigger(); });
  }
  
  void update() enter {
    //if (!isShowing()) { inputChooser.forgetInput(); ret; }
    S s = dm_topInput(); //inputChooser.input();
    
    root = ai_parseToTreeWithCurlyPhrases(s);
    
    S rendered = ai_renderParseTree(root);
    bool shouldVis = neq(rendered, lastOutput);
    lastOutput = rendered;
    if (shouldVis) {
      JTree tree = jDynamicTree(root, func(final PTElement e) -> L<PTElement> { e == null ? null : e.children });
      setComponent(tree);
      ai_openMainParseInJTree(tree);
    }
  }
}

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: 419 / 3236
Version history: 4 change(s)
Referenced in: [show references]