@bbc/stt-align-node

中文文档
1.4.3发布于 2022/02/23MITCommonJS近 30 天下载 3620
原始使用文档
文档目录9 节
  1. Setup - development
  2. Setup - in production
  3. Usage
  4. System Architecture
  5. Development env
  6. Build
  7. build demo
  8. Tests
  9. Deployment

Stt-align-node

See The alignment problem in the docs for more background of the problem this module set out to address.

Originally developed as a node version of python's stt-align by Chris Baume - BBC R&D.

Setup - development

git clone [email protected]:bbc/stt-align-node.git
cd stt-align-node
npm install

Setup - in production

npm install @bbc/stt-align-node

Usage

Other then to realign STT results with accurate text, this modules can also be used to perform related oprations in the same domain, such as benchmarking STT.

FunctionDescriptiontype
alignSTTRealign STT json with accurate text. by transposing words from accurate text to timecodes of STT.json
diffsListreturn a diff json of STT vs accurate textjson
diffsListAsHtmlreturn a diff of STT vs accurate text as HTMLhtml
diffsCountreturn a diff of STT vs accurate text as HTMLjson
calculateWordDurationreturn a diff of STT vs accurate text as HTMLNumber

See See README in example-usage folder as well as code examples for more.


System Architecture

Node version of stt-align by Chris Baume - R&D.

In pseudo code overview of alignSTT:

  • input, output as described in the example usage.

    • Accurate base text transcription, string.
    • Array of word objects transcription from STT service.
  • Align words

    • normalize words, by removing capitalization and punctuation and converting numbers to letters

    • generate array list of words from base text, and array list of words from stt transcript.

      • get opcodes using difflib comparing two arrays
      • for equal matches, add matched STT word objects segment to results array base text index position.
      • Then iterate to result array to replace STT word objects text with words from base text
    • interpolate missing words

      • calculates missing timecodes
      • first optimization
        • using neighboring words to do a first pass at setting missing start and end time when present
      • Then Missing word timings are interpolated using interpolation library 'everpolate.

Development env

  • node 10
  • npm 6.1.0

Build

npm run build

bundles the code with react, into a ./build folder.

build demo

npm run build:demo

Demo is in docs folder

Publish demo to github pages

npm run deploy:ghpages

Tests

npm run test:watch
  • add more tests

Deployment

Deploy to npm

npm run publish:public

版本与发布记录

@bbc/stt-align-node 共发布 5 个版本,首次发布于 2019/08/03;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.4.3latest2022/02/234 年前
1.4.12019/11/067 年前
1.4.02019/11/067 年前
1.1.02019/09/117 年前
1.0.02019/08/037 年前

关于 @bbc/stt-align-node 的常见问题

如何安装 @bbc/stt-align-node?

在项目目录运行 npm install @bbc/stt-align-node,或使用 pnpm add / yarn add / bun add。

@bbc/stt-align-node 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bbc__stt-align-node 是否存在。

@bbc/stt-align-node 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bbc/stt-align-node 可以商用吗?

@bbc/stt-align-node 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bbc/stt-align-node 的下载量有多少?

根据 npm 官方下载统计,@bbc/stt-align-node 在 2026/10/08 – 2026/11/06 这 30 天内被下载 3,620 次,日均约 121 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bbc/stt-align-node 还在维护吗?

最新版本 1.4.3 发布于 2022/02/23(4 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/08/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。