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

29
LINES

< > BotCompany Repo | #1017395 // English Parse Tree With Weights [OK]

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

Libraryless. Click here for Pure Java version (18685L/136K).

1  
!7
2  
3  
sclass BottomUpParser > DynSCPWithInput {
4  
  start {
5  
    set flag DynModule. // for transpilation
6  
    dm_useLocallyCopiedMechLists(); set flag NoFancyMechParsing.
7  
    ai_parser_activateStandardFunctions();
8  
  }
9  
  
10  
  void update(S s) {
11  
    temp enter();
12  
    if (!isShowing()) { inputChooser.forgetInput(); ret; }
13  
    
14  
    final new AI_BottomUpParser1 parser;
15  
    parser.parse(s);
16  
    AI_BottomUpParser1.Word w = parser.fullGroup();
17  
    print("Full group: " + w);
18  
    if (w == null) ret;
19  
    final L<WeightedProduction> productions = ai_buParser_parseWeightedProductions();
20  
    print("Have " + n2(productions, "production"));
21  
    
22  
    print("Classes: " + sfu(w.classes));
23  
    ChooseCategory root = new(w, withoutQuoted(w.classes));
24  
    ai_parseTree_makeWeights(parser, productions, root);
25  
    ai_parseTree_makeTotalWeights(root, 1);
26  
    
27  
    setComponent(jDynamicTree(root, func(final PTElement e) -> L<PTElement> { e.children }));
28  
  }
29  
}

Author comment

Began life as a copy of #1017392

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: #1017395
Snippet name: English Parse Tree With Weights [OK]
Eternal ID of this version: #1017395/15
Text MD5: 84987853783bb49f5f9b77ecd1d35a67
Transpilation MD5: 19f44e673ede188606038456ec51cf18
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-07-20 12:43:01
Source code size: 965 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 396 / 1055
Version history: 14 change(s)
Referenced in: [show references]