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

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

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: 397 / 1093
Version history: 12 change(s)
Referenced in: [show references]