phoneme-entropy
Phoneme-level entropy, informativity, and maximum-entropy tools. A standalone
library that bundles the entropy estimators from
entropy-estimators (MIT,
© 2025 fermosc24) and adds phonology-oriented analysis utilities.
Install
pip install phoneme-entropy
# or, from source:
pip install .
Optional extras: pip install "phoneme-entropy[plot]" (matplotlib/seaborn for
plot_ranks), pip install "phoneme-entropy[data]" (Hugging Face datasets).
Usage
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)
See examples/quickstart.py and
examples/usage_example.ipynb for a full
walkthrough.
Data
A small CELEX-derived sample ships with the package (load_sample()). The full
sample is mirrored as a gated, permissions-only Hugging Face dataset
suchirsalhan/celex-en-phoneme-sample
— 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
| Import | Purpose |
|---|---|
Entropy, FreqShrink, JS_KullbackLeibler, JS_JensenShannon |
Entropy / divergence estimators (MLE, JSE, Chao-Shen, CWJ, NBRS, NSB), vendored. |
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. |
License
MIT — see LICENSE. Bundles third-party code; see
THIRD_PARTY_LICENSES. Please cite via
CITATION.cff.
Metadata
Release files for phoneme-entropy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| phoneme_entropy-0.1.0.tar.gz | 39.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| phoneme_entropy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.7 kB
Release files / phoneme_entropy-0.1.0.tar.gz
| Download URL | phoneme_entropy-0.1.0.tar.gz |
|---|---|
| Size | 39.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88fd072a852bffda8eb71767eadfefc9759acbbdc6cf294fbfb433045b079f19
|
|
BLAKE2b-256 checksum How to use checksums |
fd55183614e5afb97fb178b3a1c3ac399e9df0cc9f7c1ac49c74874c32c6d444
|
| 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 logRelease files / phoneme_entropy-0.1.0-py3-none-any.whl
| Download URL | phoneme_entropy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf8ee5d31807f892aac6d5644e2cdf938ef0704a150c02b78b9c9fe44d7ea52c
|
|
BLAKE2b-256 checksum How to use checksums |
6293a25a9272724ecd1cc20b37d40b5168fa98455713ec18b9ac453e8550d51a
|
| 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