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

34
LINES

< > BotCompany Repo | #1017472 // English Parse Tree v2 w/guessing unknown words [OK]

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

Libraryless. Click here for Pure Java version (19034L/139K).

!7

sclass BottomUpParser > DynSCPWithInput {
  transient S lastOutput;
  transient PTElement root;
  
  visualize {
    ret withCenteredButtons(super.visualize(),
      "Good Parse", rThread { addToMechList_noUniq("Good english parses", "\n" + ai_renderCulledParseTree(root)) });
  }
  
  start {
    set flag DynModule. // for transpilation
    dm_useLocallyCopiedMechLists(); set flag NoFancyMechParsing.
    ai_parser_activateStandardFunctions();
    doEvery(5000, r { if (dm_isShowingAndOSInForeground()) update(inputChooser.input()) });
  }
  
  void update(S s) {
    temp enter();
    if (!isShowing()) { inputChooser.forgetInput(); ret; }
    
    root = ai_parseToTreeWithGuessing(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 #1017395

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: #1017472
Snippet name: English Parse Tree v2 w/guessing unknown words [OK]
Eternal ID of this version: #1017472/13
Text MD5: 0b55e34491bdbb5bc4d9fab19b235cd8
Transpilation MD5: 3db1a126ee8028f1e106697e82ef6de1
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: 2018-08-02 12:22:06
Source code size: 1060 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 464 / 1176
Version history: 12 change(s)
Referenced in: [show references]