Skip to main content

phone-metrics

Install

pip install phone-metrics

Data setup

TIMIT requires no preparation; use the root of the official distribution directly.

Download VoxAngeles with the following:

git clone --branch main --depth 1 https://github.com/pacscilab/voxangeles.git data/voxangeles
cd data/voxangeles/data/audited_aligned
for file in *.zip; do
    unzip -o "$file"
done

Buckeye needs unpacking and correcting. Point the command at a directory holding the official s01.zip ... s40.zip; it writes the corpus/ that load_buckeye reads.

phone-metrics-prepare-buckeye data/buckeye

The command applies the Montreal Forced Aligner project's transcription corrections.

Load evaluation data

from phone_metrics import load_buckeye, load_timit, load_voxangeles

datasets = {
    "timit-test": load_timit("data/TIMIT", split="test"),
    "buckeye-test": load_buckeye("data/buckeye"),
    "voxangeles": load_voxangeles("data/voxangeles"),
}

Score segmentation and recognition

from phone_metrics import PrecisionRecallMetric, phone_error_rates


def evaluate(utterances, predicted_boundaries, predicted_phones):
    segmentation = PrecisionRecallMetric(tolerance=0.02, mode="strict")
    for utterance, boundaries in zip(utterances, predicted_boundaries, strict=True):
        segmentation.update(utterance.boundaries, boundaries)

    return segmentation.compute(), phone_error_rates(
        utterances,
        predicted_phones,
        label="ipa",
    )


for name, utterances in datasets.items():
    predicted_boundaries, predicted_phones = run_model(utterances)
    segmentation, recognition = evaluate(
        utterances,
        predicted_boundaries,
        predicted_phones,
    )
    print(name, segmentation)
    print({"per": recognition.per, "pfer": recognition.pfer, "ter": recognition.ter})

Predicted boundaries are seconds relative to the utterance. Make sure to read Buckeye audio using each utterance's offset and duration. predicted_phones contains one IPA sequence per utterance.

Reference

The Buckeye speaker splits follow:

H. Kamper, A. Jansen, and S. Goldwater, “A segmental framework for fully-unsupervised large-vocabulary speech recognition,” Computer Speech & Language, vol. 46, pp. 154–174, 2017.

Metadata

Release files for phone-metrics 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phone-metrics 0.1.0
File Size Uploaded
phone_metrics-0.1.0.tar.gz 181.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phone-metrics 0.1.0
File Interpreter ABI Platform
phone_metrics-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 360.8 kB

Release files / phone_metrics-0.1.0.tar.gz

Download URL phone_metrics-0.1.0.tar.gz
Size 181.3 kB
Tags Source
SHA-256 checksum
How to use checksums
de39ce7bbb29dddcf8bc905c80986d36f0e050a72821def213fd9547ce17d91d
BLAKE2b-256 checksum
How to use checksums
017a12bf0dbee4aaca36b2bc638017ec63866ead0f7891359f3a0a9c10002096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / phone_metrics-0.1.0-py3-none-any.whl

Download URL phone_metrics-0.1.0-py3-none-any.whl
Size 179.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c9e1ff657066b6f4fffd18d5e3460a6ba34abe9b71ea55fca2595fad4d2e04d
BLAKE2b-256 checksum
How to use checksums
b52423666e91293bc31bd18e984afcc5c67cb985d001394ca5f6d5aff689b93c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page