Uses 455K of libraries. Click here for Pure Java version (3360L/23K/72K).
!7 /* curl -XPOST 'https://api.wit.ai/speech?v=20160526' -i -L -H "Authorization: Bearer $TOKEN" -H "Content-Type: audio/wav" --data-binary "@20170226-024709.wav" */ p-tt { // make speech to recognize File wavFile = prepareProgramFile("penguin.wav"); S originalText = "Hello Penguin"; if (wavFile.length() == 0) { print("Making speech"); williamSpeaksForSphinx(originalText, wavFile); } print("Calling wit.ai with " + toK(wavFile.length()) + " K wav..."); S token = witAIToken(); URL url = new URL("https://api.wit.ai/speech?v=20160526"); URLConnection con = url.openConnection(); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-Type", "audio/wav"); con.setDoOutput(true); OutputStream out = con.getOutputStream(); file2stream(wavFile, out); out.flush(); S contents = loadPage(con, url); out.close(); print("JSON:"); print(contents); S text = getString(jsonDecodeMap(contents), "_text"); print("ORIGINAL TEXT: " + originalText); print("RECOGNIZED TEXT: " + text); print(); print(match(originalText, text) ? "FULL MATCH!" : "Not a full match."); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007041 |
Snippet name: | Test wit.ai speech recognition with .wav [WORKS if you have a wit.ai token] |
Eternal ID of this version: | #1007041/9 |
Text MD5: | e53727b7bed8d4579620cc9b5e3263e6 |
Transpilation MD5: | a18d51665c698cc51067d54750662164 |
Author: | stefan |
Category: | javax / speech recognition |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-26 13:51:49 |
Source code size: | 1212 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 818 / 886 |
Version history: | 8 change(s) |
Referenced in: | #1007044 - Test wit.ai speech recognition with .mp3 [WORKS with token] |