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

1  
!7
2  
3  
!include once #1020738 // Base Include
4  
5  
static void wavToMP3_128k(File wav, File mp3) {
6  
  javaLame_wavToMP3_mono(wav, mp3);
7  
}
8  
9  
// reacts to new recording or file path on clipboard
10  
module WitAILastRecording > DynPrintLog {
11  
  bool sendUnrecognized; // annoying when in Alexa Mode
12  
  
13  
  start {
14  
    dm_onNewRecordingOrWAVOnClipboard(voidfunc(File f) {
15  
      print("Analyzing " + f.getName());
16  
      fS text = witAI_recognizeWAV(f);
17  
      swing {
18  
        S info = "wit.ai english";
19  
        if (empty(text)) {
20  
          print("Didn't recognize any text");
21  
          if (sendUnrecognized)
22  
            katze_userSaid(info, "?");
23  
        } else {
24  
          S corrected = dm_correctRecognizedSpeech(text);
25  
          if (neq(corrected, text)) {
26  
            print("Correcting " + quote(text) + " to " + quote(corrected));
27  
            vmBus_send('correctedRecognizedSpeech, text, corrected);
28  
          } else
29  
            print("Recognized: " + text);
30  
            
31  
          if (!dm_osInForeground())
32  
            flatInfoBox(corrected);
33  
34  
          print("Recognized: " + corrected);
35  
          dm_setAIBarTextAndFireWithInfo(corrected, info);
36  
        }
37  
      }
38  
    });
39  
  }
40  
}

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: 301 / 9149
Version history: 21 change(s)
Referenced in: [show references]