Stt-align-node
node version of stt-align by Chris Baume - R&D.
Work in progress
Setup - development
git clon git@github.com:bbc/stt-align-node.git
cd stt-align-node
npm install
Setup - in production
npm install @bbc/stt-align-node
Usage
Usage for alignment
const alignJSONText = require('./index.js');
const transcriptText = 'There was a day, about 10 years ago, when I asked a friend to hold a baby dinosaur robot upside down. ';
const transcriptStt = {
words: [
{ start: 13.05, end: 13.21, word: 'there' },
{ start: 13.38, end: 13.44, word: 'a' },
{ start: 14.13, end: 14.37, word: 'ten' },
{ start: 14.61, end: 15.15, word: 'ago' },
{ start: 15.44, end: 15.67, word: 'when' },
{ start: 16.65, end: 16.74, word: 'to' },
{ start: 19.17, end: 19.56, word: 'down' }
]
}
const result = alignJSONText( transcriptStt, transcriptText);
console.log(result);
See /lib/example-usage
for an example that you can run with npm run example
.
Example output
{ text: 'There was a day, about 10 years ago, when I asked a friend to hold a baby dinosaur robot upside down. ',
words:
[ { start: 13.05, end: 13.21, word: 'There' },
{ word: 'was', start: 13.215, end: 13.325 },
{ start: 13.38, end: 13.44, word: 'a' },
{ word: 'day,', start: 13.626000000000001, end: 13.84 },
{ word: 'about', start: 13.872, end: 14.239999999999998 },
{ word: '10', start: 14.118, end: 14.639999999999999 },
{ word: 'years', start: 14.364, end: 15.04 },
{ end: 15.44, start: 14.61, word: 'ago,' },
{ start: 15.15, end: 15.67, word: 'when' },
{ word: 'I', start: 15.450000000000001, end: 15.883999999999999 },
{ word: 'asked', start: 15.75, end: 16.098 },
{ word: 'a', start: 16.05, end: 16.311999999999998 },
{ word: 'friend', start: 16.35, end: 16.525999999999996 },
{ start: 16.65, end: 16.74, word: 'to' },
{ word: 'hold',
start: 17.009999999999998,
end: 17.142857142857142 },
{ word: 'a', start: 17.369999999999997, end: 17.545714285714286 },
{ word: 'baby',
start: 17.729999999999997,
end: 17.948571428571427 },
{ word: 'dinosaur', start: 18.09, end: 18.35142857142857 },
{ word: 'robot', start: 18.45, end: 18.754285714285714 },
{ word: 'upside', start: 18.81, end: 19.15714285714286 },
{ start: 19.17, end: 19.56, word: 'down.' } ] }
There are other utilities, see src/example-usage.js
for other examples of functions available as part of this module.
System Architecture
Node version of stt-align by Chris Baume - R&D.
In pseudo code
Development env
Build
npm run build
bundles the code with react, into a ./build
folder.
build demo
npm run build:demo
demo is in docs folder using github pages
Tests
npm run test:watch
Deployment
npm run publish:public