Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ibm watson stt #52

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
576 changes: 575 additions & 1 deletion package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@
"ffmpeg-static-electron": "^2.0.1",
"ffprobe-static-electron": "^2.0.0",
"fluent-ffmpeg": "^2.1.2",
"ibm-watson": "^5.7.1",
"react": "^16.11.0",
"react-bootstrap": "^1.0.0-beta.14",
"react-dom": "^16.10.2",
"tmp": "^0.1.0"
}
}
}
25 changes: 13 additions & 12 deletions src/ElectronWrapper/lib/transcriber/deepspeech/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
const deepSpeechSttWrapper = require('deepspeech-node-wrapper');
// const convertPoketsphinxOutputToJson = require('./pocketsphinx-output-to-json/index.js');
/**
* @function transcribe
* @description transcribes
* @param {object} config - The parameter containting attribute options.
* @param {object} config.audio - file path to audio
* @param {callback} cb -
*/
* @function transcribe
* @description transcribes
* @param {object} config - The parameter containting attribute options.
* @param {object} config.audio - file path to audio
* @param promise
*/
function transcribe(audioFile, models) {
console.log('deepspeech: getting started');
return new Promise((resolve, reject) => {
// TODO: convert to audio wav specs first

return new Promise((resolve, reject) => {
// TODO: convert to audio wav specs first
deepSpeechSttWrapper(audioFile, models)
.then((res) => {
.then(res => {
console.info('deepspeech: response ');
resolve(res);
}).catch((error) => {
})
.catch(error => {
console.log(error);
reject(error);
});
});
}

module.exports = transcribe;
module.exports = transcribe;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';
const fs = require('fs');
var convertIBMWatsonToDpe = require('./index.js');

var exampleJSON = require('./ibmwatson.sample.json');

const exampleOutput = convertIBMWatsonToDpe(exampleJSON);
console.log(JSON.stringify(exampleOutput, null, 2));

fs.writeFileSync(__dirname + '/test.json', JSON.stringify(exampleOutput, null, 2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"results": [
{
"word_alternatives": [
{
"start_time": 0.15,
"alternatives": [
{
"confidence": 1,
"word": "a"
}
],
"end_time": 0.3
},
{
"start_time": 0.3,
"alternatives": [
{
"confidence": 1,
"word": "line"
}
],
"end_time": 0.64
},
{
"start_time": 0.64,
"alternatives": [
{
"confidence": 1,
"word": "of"
}
],
"end_time": 0.73
},
{
"start_time": 0.73,
"alternatives": [
{
"confidence": 1,
"word": "severe"
}
],
"end_time": 1.08
},
{
"start_time": 1.08,
"alternatives": [
{
"confidence": 1,
"word": "thunderstorms"
}
],
"end_time": 1.85
},
{
"start_time": 1.85,
"alternatives": [
{
"confidence": 1,
"word": "with"
}
],
"end_time": 2
},
{
"start_time": 2,
"alternatives": [
{
"confidence": 1,
"word": "several"
}
],
"end_time": 2.52
},
{
"start_time": 2.52,
"alternatives": [
{
"confidence": 1,
"word": "possible"
}
],
"end_time": 3.03
},
{
"start_time": 3.03,
"alternatives": [
{
"confidence": 1,
"word": "tornadoes"
}
],
"end_time": 3.85
},
{
"start_time": 3.95,
"alternatives": [
{
"confidence": 1,
"word": "is"
}
],
"end_time": 4.13
},
{
"start_time": 4.13,
"alternatives": [
{
"confidence": 1,
"word": "approaching"
}
],
"end_time": 4.58
},
{
"start_time": 4.58,
"alternatives": [
{
"confidence": 0.96,
"word": "Colorado"
}
],
"end_time": 5.16
},
{
"start_time": 5.16,
"alternatives": [
{
"confidence": 0.95,
"word": "on"
}
],
"end_time": 5.32
},
{
"start_time": 5.32,
"alternatives": [
{
"confidence": 0.98,
"word": "Sunday"
}
],
"end_time": 6.04
}
],
"keywords_result": {
"colorado": [
{
"normalized_text": "Colorado",
"start_time": 4.58,
"confidence": 0.96,
"end_time": 5.16
}
],
"tornadoes": [
{
"normalized_text": "tornadoes",
"start_time": 3.03,
"confidence": 1,
"end_time": 3.85
}
]
},
"alternatives": [
{
"confidence": 1,
"transcript": "a line of severe thunderstorms with several possible tornadoes is approaching Colorado on Sunday "
}
],
"final": true
}
],
"result_index": 0
}
Loading