Skip to main content

🔤 phoneme-entropy

Phoneme-level entropy, informativity, and maximum-entropy tools for Python.

A standalone, reproducible toolkit for information-theoretic phonology — built on top of entropy-estimators.

PyPI version Python License: MIT CI Dataset on HF

▶️ Try it in your browser — no install required

Open the quickstart in Google Colab


✨ What you get

  • 📊 Entropy & divergence estimators — MLE, James–Stein, Chao–Shen, Chao–Wang–Jost, NBRS, and NSB, bundled and ready to call.
  • 🔡 Segmental informativity — per-phoneme next-phoneme surprisal and prefix entropy over words encoded as phoneme strings.
  • 🎲 Symmetric-Dirichlet inference — recover a concentration parameter α from an entropy estimate, with predicted rank/probability curves.
  • 🧮 Maximum-entropy fitting — fit a distribution to target feature expectations via the convex dual.
  • 📦 Batteries included — ships a CELEX sample so every example runs out of the box; reproducible, tested, and pip-installable.

🚀 Install

pip install phoneme-entropy
Optional extras
pip install "phoneme-entropy[plot]"   # matplotlib + seaborn for plot_ranks
pip install "phoneme-entropy[data]"   # Hugging Face datasets loader

⚡ Quickstart

from collections import defaultdict
import numpy as np, pandas as pd
from phoneme_entropy import (
    Entropy, estimate_alpha_entropy,
    segment_informativity, phoneme_prefix_entropy,
    compute_maxent_from_matrix,
)
from phoneme_entropy.data import load_sample

sample = load_sample()                       # bundled CELEX sample (Word = space-separated phonemes)

# Per-phoneme next-phoneme surprisal and prefix entropy
surprisal = segment_informativity(sample["Word"])
prefix_H  = phoneme_prefix_entropy(sample["Word"])

# Symmetric-Dirichlet concentration implied by an entropy estimate
phon = defaultdict(int)
for w in sample["Word"]:
    for p in w.split(): phon[p] += 1
alpha, se = estimate_alpha_entropy(list(phon.values()), n_boot=0)

📓 Notebooks & examples

Notebook Open What it does
Colab quickstart Self-contained: pip installs from PyPI and runs the full pipeline on the bundled sample.
Tutorial The same walkthrough for local or Colab use.
quickstart.py — Script version of the walkthrough.

🗂️ Data

A small CELEX-derived sample ships with the package — just call load_sample().

The full sample is mirrored as a 🤗 gated dataset (permissions-only) — access is granted to holders of a valid CELEX/LDC license (LDC96L14):

from phoneme_entropy.data import load_hf_dataset
ds = load_hf_dataset(split="train")   # after your access request is approved

🧰 API at a glance

Import Purpose
Entropy, FreqShrink, JS_KullbackLeibler, JS_JensenShannon Entropy / divergence estimators (MLE, JSE, Chao-Shen, CWJ, NBRS, NSB).
estimate_alpha_entropy, dirichlet_entropy, plot_ranks Symmetric-Dirichlet inference and rank/probability curves.
segment_informativity, phoneme_prefix_entropy Segmental informativity over phoneme strings.
compute_maxent_from_matrix Maximum-entropy fit to feature expectations.
phoneme_entropy.data.load_sample, load_hf_dataset Data loaders.

📖 Citation & license

Released under the MIT License. Bundles third-party code — see THIRD_PARTY_LICENSES. If you use this library, please cite it (see CITATION.cff) along with the upstream entropy-estimators project.

Built with ❤️ for reproducible information-theoretic phonology.

Metadata

Release files for phoneme-entropy 0.1.1

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

Source distribution (sdist)

Source distribution for phoneme-entropy 0.1.1
File Size Uploaded
phoneme_entropy-0.1.1.tar.gz 41.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phoneme-entropy 0.1.1
File Interpreter ABI Platform
phoneme_entropy-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 75.6 kB

Release files / phoneme_entropy-0.1.1.tar.gz

Download URL phoneme_entropy-0.1.1.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2819a695389cee057dcd2333f713b9e7b0f58f676e24ed6d735e97f6208bb460
BLAKE2b-256 checksum
How to use checksums
a79113560cef85369e857b1e84eb1b10eea3941c42a04881ae5c95453464f47a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release files / phoneme_entropy-0.1.1-py3-none-any.whl

Download URL phoneme_entropy-0.1.1-py3-none-any.whl
Size 34.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4668cb2d2196257aeee7d24ff15dc39729e167ad5f699b5fa7b626d80cfbb20
BLAKE2b-256 checksum
How to use checksums
e7ef256d6b9cb171767b6c34526ea40607930857a49aeb170952ba472e10008f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

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