Skip to main content

Production-oriented TextGrid, JSON, and MLF toolkit.

Project description

uxtg

uxtg 是一个面向生产集成的 Python 库,用于处理 Praat TextGrid、稳定 JSON 文档协议,以及 HTK MLF 转换流程。

Features

  • 分层架构:domaincodecsdocumentsmappers
  • Pydantic v2 核心领域模型
  • Praat TextGrid / TextTier / IntervalTier 读写
  • 稳定的 TextGridJsonDocument 导出与反向映射
  • MLF -> TextGrid 转换和 TextGrid 文件落盘
  • 统一异常体系与库级 facade API

Installation

poetry add uxtg

Stable API

import uxtg

grid = uxtg.read_textgrid("sample.TextGrid", strict=True)
document = uxtg.textgrid_to_json_document(grid)
restored = uxtg.json_document_to_textgrid(document)
mlf = uxtg.read_mlf("labels.mlf")

Public Objects

  • Point, Interval, PointTier, IntervalTier, TextGrid
  • TextGridJsonDocument
  • MLF

Public Functions

  • parse_textgrid(text, *, round_digits=..., strict=True)
  • read_textgrid(path, *, round_digits=..., strict=True, encoding=None)
  • write_textgrid(textgrid, target, *, null="")
  • read_mlf(path_or_text, *, samplerate=..., round_digits=...)
  • textgrid_to_json_document(textgrid)
  • json_document_to_textgrid(document)

Errors

  • UXTGError
  • ParseError
  • SerializationError
  • UnsupportedFormatError
  • DomainValidationError

Supported Formats

Format Read Write Notes
Praat TextGrid Yes Yes TextGrid, TextTier, IntervalTier
JSON document Yes Yes Stable protocol via TextGridJsonDocument
HTK MLF Yes Partial Stable MLF -> TextGrid; write emits TextGrid files

Engineering

  • pytest + coverage threshold
  • ruff
  • mypy
  • benchmark fixtures
  • GitHub Actions CI for Python 3.10 / 3.11 / 3.12

Versioning

0.3.0 是一次破坏性升级版本。后续版本按 semver 演进。

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

uxtg-0.3.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

uxtg-0.3.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file uxtg-0.3.0.tar.gz.

File metadata

  • Download URL: uxtg-0.3.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.3 Linux/6.17.0-19-generic

File hashes

Hashes for uxtg-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1bd96aa4cf15fd39be58829b388d3b4f298f054e7ba8e361bc48dc0915a3d07d
MD5 625e3c24909a47777386e5537f43d7ee
BLAKE2b-256 8667ee914ed42f42f9420b9f45faad24dbdc4f7dea4c6fa65f2375bd59bc2427

See more details on using hashes here.

File details

Details for the file uxtg-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: uxtg-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.3 Linux/6.17.0-19-generic

File hashes

Hashes for uxtg-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dfb4ce5ee892771262d85a8a22ea1ea14c7a24b8846935f6e3cc9b8bf8456bc2
MD5 645ccec28cc9a669e8fd0513093eb197
BLAKE2b-256 6c6bf3d6b71b77f1fb2ade1a34aefaf9bd1249a0cdd549f62a02cd61290ef1a1

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