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

33
LINES

< > BotCompany Repo | #1022812 // Current time dialog v2 [shortened, same functionality as v1]

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

Uses 911K of libraries. Click here for Pure Java version (11380L/59K).

!7

cmodule CurrentTimeDialog > DynSayAndInputBot {
  class TimeBot extends AbstractSayAndInputBot2 implements Runnable {
    Attractor
      thanks = new MatchAttractor("thanks|thank you|thx", r { say("You're welcome") }),
      whatCanYouDo = new MatchAttractor("what can you do...|what is your skill|who are you", r {
        say("I can tell you the time");
        addAttractor(doIt);
      }),
      doIt = new MatchAttractor("do it|ok|i want that", r sayTime),
      talkToMe = new MatchAttractor("talk to me|hi|talk|say something", r run_public),
      doItAgain = new MatchAttractor("do it again|again|another time", r sayTime),
      whatsTheTime = new MatchAttractor("what's the time|tell me the time|time", r sayTime),
      yes_SayTime = new Attractor(f<S, Bool> isYes_1, r sayTime),
      sayOK = new Attractor(f1_true(), r { say("OK") });
      
    *() {
      addPreprocessors(f ai_dropLeadingAndTrailingAppellations_sortedByLength);
      standardAttractors(doItAgain, whatsTheTime, talkToMe, whatCanYouDo, thanks);
    }
    
    public void run {
      say("Do you want to know the current time?");
      addAttractor(yes_SayTime);
      addLowPrioAttractor(sayOK);
    }
    
    void sayTime { say("It is " + localTime_24()); }
  }
  
  TimeBot makeBot() { ret new TimeBot; }
}

Author comment

Began life as a copy of #1022809

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022812
Snippet name: Current time dialog v2 [shortened, same functionality as v1]
Eternal ID of this version: #1022812/10
Text MD5: 254534f7f681268ded34a53029059fdb
Transpilation MD5: da694531638cab6f0c169f9839e8f349
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: 2019-04-09 01:05:54
Source code size: 1330 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 228 / 391
Version history: 9 change(s)
Referenced in: [show references]