Giter Site home page Giter Site logo

transcript-model's Introduction

transcript-model

Build Status npm

JSON schema and JavaScript model classes for dealing with time-aligned transcripts of speech.

Usage

Install in your project

$ npm install --save transcript-model

Then

const { Transcript } = require('transcript-model');

// Define some transcript JSON
const json = {
  speakers: [{ name: 'Alice' }, { name: 'Bob' }],
  segments: [
    {
      speaker: 0,
      words: [
        { start: 0.05, end: 0.64, text: 'Hello' },
        { start: 0.7, end: 1.1, text: 'Bob!' },
      ],
    },
    {
      speaker: 1,
      words: [
        { start: 1.53, end: 1.88, text: 'Hi' },
        { start: 1.92, end: 2.33, text: 'Alice.' },
      ],
    },
  ],
};

// Instantiate a Transcript object
const transcript = Transcript.fromJson(json);

// Do something with it
console.log(
  transcript.segments
    .map(
      segment =>
        `${transcript.speakers.get(segment.speaker).name}: ${segment.words
          .map(word => word.text)
          .join(' ')}`
    )
    .join('\n')
);

// Serialise as JSON
console.log(transcript.toJson());

Try it out on RunKit.

For more examples of creating and manipulating Transcript objects check out the source code.

CLI

A basic command line interface has been implemented to support conversion of BBC Kaldi output to the transcript JSON format.

Install

$ npm install -g transcript-model

Usage

To write to STDOUT:

$ transcript-model --kaldi path/to/transcript.json path/to/segments.json

To write to a file:

$ transcript-model --kaldi path/to/transcript.json path/to/segments.json > output.json

Author

transcript-model's People

Contributors

alexnorton avatar

Stargazers

Casey Gollan avatar Collin Allen avatar  avatar Jagdeesh Karicherla avatar Kyle Brodeur avatar Cat  avatar Pawel Cyrta avatar Ryan Murphy avatar Timo Behrens avatar kuus avatar  avatar Jessie Schalles avatar Chris Baume avatar Vanessa Dennis avatar Chris Amico avatar Laurian Gridinoc avatar

Watchers

Laurian Gridinoc avatar  avatar Tom Cartwright avatar Andy Robinson avatar James Cloos avatar Stefano Belloro avatar Richard Lynton-Evans avatar Miles Bernie avatar Steve Wheeler avatar Lei He avatar Pietro avatar Dave Bevan avatar Nathan Messer avatar Alex Duff avatar  avatar Joe Sparrow avatar Mark Kay avatar Eimi Okuno avatar James Dooley avatar  avatar Robert McKenzie avatar  avatar  avatar David Brown avatar Simon Allcorn avatar  avatar Andrew Blaney avatar  avatar  avatar Jon Acosta avatar

transcript-model's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.