Skip to main content

TalkBank CHAT processing pipeline

Project description

batchalign

TalkBank CHAT processing pipeline — ASR, forced alignment, morphosyntax (%mor / %gra), utterance segmentation, translation, and compare. The user-facing Python package; the runtime is a PyO3 extension backed by the Rust crates in crates/batchalign/.

User and developer docs live in book/src/batchalign/ (the mdBook is the source of truth). See book/src/batchalign/developer/building.md for the canonical build recipe.

Install

From PyPI (stable wheels):

pip install batchalign

From source: use the just recipes — they go through Bazel, so every dep (proto codegen, Rust crates, PyO3 extension, Python wheel extras) is materialized for you. Don't reach for maturin develop or uv sync directly unless you're debugging the build itself.

just batchalign build              # build every Bazel target for batchalign
just batchalign test               # run every Bazel test target
just batchalign cli --help         # run `batchalign3` via the development bridge
just batchalign pytest             # pytest (with full Bazel dep graph)
just batchalign wheel              # host-platform wheel at python/target/wheels/
just batchalign sidecar            # standalone daemon binary via PyApp
just batchalign lint               # mypy (+ ruff)
just batchalign versions           # source-of-truth version readout

just --list batchalign shows the full recipe list. The just recipes call into Bazel, so tools/bazel (the bundled wrapper) takes care of:

  • regenerating the pydantic-v2 wire types from crates/batchalign/batchalign-core/src/proto/*.rs
  • rebuilding the batchalign_core PyO3 cdylib via maturin under the hood
  • staging the binary into the wheel
  • propagating dependency changes to dependent targets

If you genuinely need bazel directly (because a recipe you want isn't wrapped):

bazel build //...           # everything
bazel test //...            # everything
bazel run //book:html       # static book HTML
bazel run //apps/batchalign/batchalign-gui:openapi   # GUI OpenAPI codegen

The base wheel ships only the lightweight runtime. Heavy ML backends are gated behind extras — install only what you use:

pip install 'batchalign[whisper]'      # Whisper ASR
pip install 'batchalign[stanza]'       # morphosyntax (%mor / %gra)
pip install 'batchalign[pyannote]'     # speaker diarization
pip install 'batchalign[revai]'        # Rev.AI cloud ASR
pip install 'batchalign[cantonese]'    # Cantonese pipeline (FunASR, Tencent)
pip install 'batchalign[qwen3]'        # Qwen3 ASR + forced aligner
pip install 'batchalign[nllb]'         # NLLB translation
pip install 'batchalign[api]'          # FastAPI daemon (`batchalign3 daemon`)
pip install 'batchalign[all]'          # everything

CLI

batchalign3 --help

batchalign3 transcribe input_dir -o output_dir --lang eng
batchalign3 align     input_dir -o output_dir --engine wav2vec
batchalign3 morphotag input_dir -o output_dir --language en
batchalign3 utseg     input_dir -o output_dir
batchalign3 translate input_dir -o output_dir --target eng
batchalign3 compare   input_dir gold_dir   -o output_dir

batchalign3 version                    # banner, version, git SHA
batchalign3 cache {path,stats,clear}   # local result cache
batchalign3 daemon                     # FastAPI server (needs [api])

When -o is omitted, results are written back in place. The CLI accepts either a single CHAT/media file or a folder (walked recursively).

Programmatic API

import batchalign as ba

# Build a backend chain.
pipeline = ba.recipes.morphotag(
    stanza_backend=ba.StanzaBackend(lang="en"),
)

# Or compose your own.
asr = ba.WhisperBackend(language=ba.LanguageCode.from_iso("eng"))
utseg = ba.CHATUtteranceBackend(model="talkbank/CHATUtterance-en")
pipeline = ba.recipes.transcribe(asr_backend=asr, utseg_backend=utseg)

# Run.
inputs = [ba.media_from_path("session.wav")]
outcomes = list(pipeline.run(inputs))
for outcome in outcomes:
    outcome.write("session.cha")

Repository layout

This package is one slice of the talkbank-tools monorepo:

  • python/batchalign/ — Python package (this file).
  • crates/batchalign/ — Rust crates (batchalign-core, batchalign-engine).
  • crates/core/ — shared CHAT parser / model / transform.
  • apps/batchalign/batchalign-gui/ — Tauri desktop GUI.
  • book/ — user + developer documentation (mdBook; source of truth).

For repo conventions, build commands, and the BA3 cutover plan, see CLAUDE.md at the repo root and book/src/batchalign/developer/landing-status.md.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

batchalign-0.9.0a4-cp310-abi3-manylinux_2_34_x86_64.whl (13.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

batchalign-0.9.0a4-cp310-abi3-manylinux_2_34_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ ARM64

batchalign-0.9.0a4-cp310-abi3-macosx_11_0_arm64.whl (7.6 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file batchalign-0.9.0a4-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for batchalign-0.9.0a4-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6a4ad26efedff75d0b42ca0871f7cc66a09c15a66c2c0ef9399c5eed8eb95e60
MD5 2257bb753a79bc0349334338aa4de7cd
BLAKE2b-256 8c56091bdae994f6ebeb8bffc7fdc0a91dfa4cfd8673de0bceaad69b4ca88188

See more details on using hashes here.

File details

Details for the file batchalign-0.9.0a4-cp310-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for batchalign-0.9.0a4-cp310-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 24399b7c98aeb5885ca74900e95415aae1dfcb5e370ca3ffb9fb1b8e665c06f4
MD5 6cd3681549804cba71091169c8393393
BLAKE2b-256 7eb52083630ada51a4f597761697113190a8b13cc6904c27c5bb871d8fbbd62b

See more details on using hashes here.

File details

Details for the file batchalign-0.9.0a4-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for batchalign-0.9.0a4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 334e55011c7da793ded29ad9bfaf3f2fd3406ecb517314c7d335876a7530e228
MD5 97bd4fa9c6382b40a9054318d0e6c0af
BLAKE2b-256 596b152839d9e0d9eeba5b001f6eacca0d554fafb204074e6e9335d69ece9804

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