Skip to main content

A utility library for working with speech-to-text transcriptions.

Project description

stt-utils

PyPI version License: MIT

A utility library for working with word-level speech-to-text timestamps. The main goal is to simplify working with timestamps generated by openai's whisper model with "word" timestamp_granularities.

Features

  • Realign word timestamps with the full text
  • Merge several transcriptions together
  • (Optional dependency) Split long audio into smaller segments by the moments of silence.

Installation

pip install stt-utils

Usage

Python API

Align word timestamps from openai whisper

from stt_utils import UnprocessedTranscription, Transcription

transcription = openai_client.audio.transcriptions.create(
    model="whisper-1",
    file=audio_file,
    response_format="verbose_json",
    timestamp_granularities=["word"],
)

unprocessed_transcription = UnprocessedTranscription(**transcription.model_dump())
aligned_transcription = Transcription.from_unprocessed_transcription(unprocessed_transcription)

aligned_transcription.dump_prevew()

Development

It is recomended to use uv toolset for development.

Testing

There are unittests available in the tests/ directory.

uv run pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

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

stt_utils-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stt_utils-0.1.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file stt_utils-0.1.2.tar.gz.

File metadata

  • Download URL: stt_utils-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for stt_utils-0.1.2.tar.gz
Algorithm Hash digest
SHA256 356cab1fea8887646f64a4bad87d311592a0c8b1116c8399e7c9fc738714b7ee
MD5 09f47734a445d31dad00a7bbeddeb6c7
BLAKE2b-256 a9b1bd9979eb3fa770b6c0b97504dd60f68086906fe4b9bbe1c32a75e06c0745

See more details on using hashes here.

File details

Details for the file stt_utils-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: stt_utils-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for stt_utils-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c210df338913a0adde3e183713bec7fc25d95b88074622c0bf214558e06ca49f
MD5 4d9a6226d303bc8dbc1706f4e74bf71e
BLAKE2b-256 44df16900dbd1a19a2ceb8067cc742c71e0c543338fca23a649d4d968fd31a29

See more details on using hashes here.

Supported by

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