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

!7

sclass Inference {
  Map<S, LS> definitions = dm_getDefinitionsMap();
  new LinkedHashSet<S> out;
  
  void process(S input) {
    for (S word : words(input)) {
      LS defs = definitions.get(word);
      if (cic(defs, "something humans often do"))
        out.add("Interpretation: You want to " + word);
    }
  }
}

module Think > DynTextArea {
  transient S input;
  
  start {
    dm_onTopInputChangeAndNow(voidfunc(S s) { input = s; updateMe() });
    doEvery(10.0, r updateMe);
  }
  
  void update {
    new Inference inference;
    
    inference.process(input);
    setText(">> " + input + "\n\n" + lines(inference.out));
  }
}

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