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

30
LINES

< > BotCompany Repo | #1020035 // Think About Input Using Definitions [dev.]

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

Libraryless. Click here for Pure Java version (14580L/101K).

1  
!7
2  
3  
sclass Inference {
4  
  Map<S, LS> definitions = dm_getDefinitionsMap();
5  
  new LinkedHashSet<S> out;
6  
  
7  
  void process(S input) {
8  
    for (S word : words(input)) {
9  
      LS defs = definitions.get(word);
10  
      if (cic(defs, "something humans often do"))
11  
        out.add("Interpretation: You want to " + word);
12  
    }
13  
  }
14  
}
15  
16  
module Think > DynTextArea {
17  
  transient S input;
18  
  
19  
  start {
20  
    dm_onTopInputChangeAndNow(voidfunc(S s) { input = s; updateMe() });
21  
    doEvery(10.0, r updateMe);
22  
  }
23  
  
24  
  void update {
25  
    new Inference inference;
26  
    
27  
    inference.process(input);
28  
    setText(">> " + input + "\n\n" + lines(inference.out));
29  
  }
30  
}

Author comment

Began life as a copy of #1020016

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020035
Snippet name: Think About Input Using Definitions [dev.]
Eternal ID of this version: #1020035/5
Text MD5: 692623df4daa0406c5b49ecaf090d8ef
Transpilation MD5: ebc3000ed6fba58ebb023ce27e4a6ad2
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-12-04 16:53:27
Source code size: 670 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 249 / 1516
Version history: 4 change(s)
Referenced in: [show references]