npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stt-align-node

v2.0.1

Published

<!-- _One liner + link to confluence page_ _Screenshot of UI - optional_ -->

Downloads

892

Readme

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]:pietrop/stt-align-node.git
cd stt-align-node
npm install

Setup - in production

npm install 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.

| Function | Description | type | | :--------------------------- | ------------------------------------------------------------------------------------------------- | -------- | | alignSTT | Realign STT json with accurate text. by transposing words from accurate text to timecodes of STT. | json | | diffsList | return a diff json of STT vs accurate text | json | | diffsListAsHtml | return a diff of STT vs accurate text as HTML | html | | diffsListAsHtmlContentOnly | return a diff of STT vs accurate text as HTML content | html | | diffsCount | return a diff of STT vs accurate text as HTML | json | | calculateWordDuration | return a diff of STT vs accurate text as HTML | Number |

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

const { alignSTT } = require('stt-align-node');
const result = alignSTT(transcriptStt, transcriptText);
// Do something with the result
const { diffsList } = require('stt-align-node');
const result = diffsList(trainscriptSttText, transcriptText);
// Do something with the result
const { diffsListAsHtml } = require('stt-align-node');
const result = diffsListAsHtml(trainscriptSttText, transcriptText, url);
// // Do something with the result
const { diffsListAsHtmlContentOnly } = require('stt-align-node');
const result = diffsListAsHtmlContentOnly(trainscriptSttText, transcriptText);
// // Do something with the result
const { diffsCount } = require('stt-align-node');
const result = diffsCount(trainscriptSttText, transcriptText);

example output

{ "equal": 1415, "insert": 8, "replace": 307, "delete": 62, "baseTextTotalWordCount": 1784, "wer": 0.21132286995515695 }

System Architecture

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