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

40
LINES

< > BotCompany Repo | #1019363 // Speech Recognition Confirmation [Did computer understand correctly?, 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 (15275L/108K).

!7

module SpeechRecogConfirmation > DynPrintLogAndButtons {
  start {
    onSpeechRecognized_withoutMyUtterancesAndTyped(voidfunc(fS s) {
      print("\nI heard: " + quote(s));
      if (eq(s, "?")) {
        fS q = "Did you say anything?";
        print(q);
        showButtons(
          "Yes", r { log(s, q, 'yes); whatDidYouSay(s); },
          "No", r { log(s, q, 'no); print("Thanks"); });
      } else {
        fS q = "Did you say that?";
        print(q);
        showButtons(
          "Yes", r { log(s, q, 'yes); print("Thanks"); },
          "No", r { log(s, q, 'no); whatDidYouSay(s); });
      }
    });
  }
  
  void log(S heard, S question, S answer) {
    print("> " + upper(answer));
    logStructure(programLogFile(), litorderedmap(+heard, +question, +answer));
    hideButtons();
  }
  
  void whatDidYouSay(fS heard) {
    print("What did you say?");
    final JTextField tf = jTextField(heard);
    showButtons(textFieldAndButton(tf, "is what I said", voidfunc(S corrected) {
      print("> I said " + quote(upper(corrected)));
      logStructure(programLogFile(), litorderedmap(+heard, +corrected));
      hideButtons();
      print("Thanks");
    }));
    focus(tf);
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019363
Snippet name: Speech Recognition Confirmation [Did computer understand correctly?, Dyn Module]
Eternal ID of this version: #1019363/17
Text MD5: bf2d18c11964643642ac0fb22eb2e60d
Transpilation MD5: 2c7d6b095aab0c66803cca06d85067cf
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-05 00:12:59
Source code size: 1236 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 313 / 615
Version history: 16 change(s)
Referenced in: [show references]