Skip to main content

A Python wrapper for the Standard Transcription JSON (STJ) format.

Project description

STJLib

PyPI Build Status Documentation Status

A Python library for the Standard Transcription JSON (STJ) format.

Overview

STJLib provides data classes and utilities for working with STJ files, which are used to represent transcribed audio and video data in a structured, machine-readable JSON format.

For more information about the STJ format, please refer to the STJ Specification.

Documentation

Full documentation is available at stjlib.readthedocs.io. This includes:

  • Detailed API reference
  • Usage examples
  • Advanced usage guides
  • Contributing guidelines

Features

  • Load and save STJ files
  • Validate STJ data according to the specification
  • Access and manipulate metadata and transcript data
  • Flexible error handling and validation reporting

Quick Start

Installation

pip install stjlib

Basic Usage

from stjlib import StandardTranscriptionJSON

# Load and validate an STJ file
stj = StandardTranscriptionJSON.from_file('path/to/file.stjson', validate=True)

# Access metadata and transcript data
print(stj.metadata)
print(stj.transcript)

# Add a segment with word timing
segment = {
    "start": 0.0,
    "end": 5.0,
    "text": "Hello world",
    "word_timing_mode": "complete",
    "words": [
        {"start": 0.0, "end": 1.0, "text": "Hello"},
        {"start": 1.0, "end": 2.0, "text": "world"}
    ]
}
stj.transcript.segments.append(segment)

# Save to file
stj.to_file('output.stjson')

For more examples and detailed usage instructions, please refer to our documentation.

File Format Support

STJLib supports the Standard Transcription JSON (STJ) format with the following file extensions:

  • Primary (Recommended): .stjson
  • Alternative: .stj
  • Alternative: .stj.json (systems supporting double extensions)

MIME Type: application/vnd.stj+json (fallback: application/json)

Development

Setting Up Development Environment

# Clone the repository
git clone https://github.com/yaniv-golan/stjlib.git
cd stjlib

# Install development dependencies
pip install -e .
pip install -r requirements-dev.txt

Running Tests

pytest

Building Documentation Locally

cd docs
make html

The documentation will be available in docs/build/html.

Contributing

We welcome contributions to stjlib! Please see our Contributing Guide for more details on how to get started.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stjlib-0.4.0.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

stjlib-0.4.0-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file stjlib-0.4.0.tar.gz.

File metadata

  • Download URL: stjlib-0.4.0.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for stjlib-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5984e27925ac158d512a9efd90bea4bc23b163afd686862df5548f92ca8aa971
MD5 3242f078218b5b0da29a3e308b854596
BLAKE2b-256 13840188cfb8ade07d1d06bd9746e3c56ba6734d903aad95d8e56e55d88caf59

See more details on using hashes here.

File details

Details for the file stjlib-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: stjlib-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for stjlib-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0352684406d23139cd7cdc44aee79f79e04632b1ead367211f0f4fe253c647bd
MD5 2a85614c5295acab627bbff961a82d9e
BLAKE2b-256 62c89dcfa1ffb7a932246fe8e658e3f0202a834615cca249e6f630215c50881e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page