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

40
LINES

< > BotCompany Repo | #1019664 // English Speech Recognizer Using Wit.AI [OK]

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

Uses 1258K of libraries. Click here for Pure Java version (6763L/37K).

!7

!include once #1020738 // Base Include

static void wavToMP3_128k(File wav, File mp3) {
  javaLame_wavToMP3_mono(wav, mp3);
}

// reacts to new recording or file path on clipboard
module WitAILastRecording > DynPrintLog {
  bool sendUnrecognized; // annoying when in Alexa Mode
  
  start {
    dm_onNewRecordingOrWAVOnClipboard(voidfunc(File f) {
      print("Analyzing " + f.getName());
      fS text = witAI_recognizeWAV(f);
      swing {
        S info = "wit.ai english";
        if (empty(text)) {
          print("Didn't recognize any text");
          if (sendUnrecognized)
            katze_userSaid(info, "?");
        } else {
          S corrected = dm_correctRecognizedSpeech(text);
          if (neq(corrected, text)) {
            print("Correcting " + quote(text) + " to " + quote(corrected));
            vmBus_send('correctedRecognizedSpeech, text, corrected);
          } else
            print("Recognized: " + text);
            
          if (!dm_osInForeground())
            flatInfoBox(corrected);

          print("Recognized: " + corrected);
          dm_setAIBarTextAndFireWithInfo(corrected, info);
        }
      }
    });
  }
}

Author comment

Began life as a copy of #1019326

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

-
Snippet ID: #1019664
Snippet name: English Speech Recognizer Using Wit.AI [OK]
Eternal ID of this version: #1019664/22
Text MD5: c6f437454712be4a9d71085e5ae7c5f0
Transpilation MD5: 0254319a677b033bbbd2d83e03057bf4
Author: stefan
Category: javax / audio recognition
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-01 19:55:09
Source code size: 1200 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 302 / 9150
Version history: 21 change(s)
Referenced in: