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

27
LINES

< > BotCompany Repo | #1016785 // Smart Answer Machine 1 [Dyn Module]

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

Uses 408K of libraries. Click here for Pure Java version (15277L/105K).

1  
!7
2  
3  
sclass SmartAnswerMachine1 > DynPrintLog {
4  
  transient new CopyOnWriteArrayList<LS> log;
5  
  bool speak = true;
6  
  
7  
  void start {
8  
    // load cat log
9  
    log.addAll(map words(katze_getFullLog()));
10  
    print("Have log entries: " + l(log));
11  
    
12  
    onSpeechRecognized_withoutMyUtterances(voidfunc(S s) { think(s) });
13  
  }
14  
  
15  
  void think(S s) {
16  
    log.add(words(s));
17  
    L<LS> l = ai_applyPrefixPairs(overlappingPairs(log), words(s));
18  
    L<S> candidates = map joinWithSpace(l);
19  
    if (empty(l)) print("\n" + s + " => no candidates\n");
20  
    else {
21  
      print("\n" + s + " => candidates:\n");
22  
      printIndent(lines(candidates));
23  
      if (speak)
24  
        dm_say(first(candidates));
25  
    }
26  
  }
27  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016785
Snippet name: Smart Answer Machine 1 [Dyn Module]
Eternal ID of this version: #1016785/6
Text MD5: 3229d6823624e3e42eeafcde459ed14f
Transpilation MD5: 17f737895e89b681d2f0b656885e2ee4
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-03 16:56:10
Source code size: 722 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 776
Version history: 5 change(s)
Referenced in: [show references]