-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample-usage-align-stt-start-end.js
100 lines (96 loc) · 1.94 KB
/
example-usage-align-stt-start-end.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// const alignSTT = require('@bbc/stt-align-node').alignSTT;
const alignSTT = require('../src/index.js').alignSTT;
const transcriptText = 'There was a day, about 10 years ago, when I asked a friend to hold a baby dinosaur robot upside down.';
const transcriptSttTest = {
"words": [
{
"text": "there"
},
{
"text": "is"
},
{
"text": "a"
},
{
"text": "day"
},
{
"text": "about"
},
{
"start": 14.13,
"end": 14.37,
"text": "ten"
},
{
"start": 14.37,
"end": 14.61,
"text": "years"
},
{
"start": 14.61,
"end": 15.15,
"text": "ago"
},
{
"start": 15.44,
"end": 15.67,
"text": "when"
},
{
"start": 15.67,
"end": 15.82,
"text": "i"
},
{
"start": 15.82,
"end": 16.19,
"text": "asked"
},
{
"start": 16.19,
"end": 16.27,
"text": "a"
},
{
"start": 16.27,
"end": 16.65,
"text": "friend"
},
{
"start": 16.65,
"end": 16.74,
"text": "to"
},
{
"start": 16.74,
"end": 17.2,
"text": "hold"
},
{
"start": 17.23,
"end": 17.32,
"text": "a"
},
{
"start": 17.32,
"end": 17.63,
"text": "baby"
},
{
"text": "dinosaur"
},
{
"text": "robot"
},
{
"text": "upside"
},
{
"text": "down"
}
]
};
const result = alignSTT( transcriptSttTest, transcriptText, 13.05, 19.6);
console.log(JSON.stringify(result, null, 2));