Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

o2i-lexicons

Default residual lexicons for orthography2ipa.

A lexicon in this package holds only the words that the orthography2ipa rules get wrong and that no rule can fix. Each entry names the gold it came from, the tier and licence of that gold, and a reason class.

The package is enabled in code, never by installing it. An installed package changes no output until the caller enables it.

Data layout

Each language has one directory, o2i_lexicons/data/<code>/. It holds two files:

File Content
<source>.tsv One word<TAB>ipa pair per line. UTF-8, NFC, lowercase words, sorted, no duplicate word.
<source>.meta.json The source dataset, its URL, tier and licence, the build command, the orthography2ipa version whose rules got each entry wrong, where the stress of the entries comes from, and the reason class of each word.

o2i_lexicons/schema.py states the contract, and the tests apply it to every packaged file.

A reason class is one of loanword, proper_noun, lexical_stress, irregular, acronym or homograph_default. Each of these claims a linguistic fact, so the sidecar states the evidence for each class in use. A word that has no evidence other than the data is unclassified.

Only a gold that can gate a quality decision in orthography2ipa can supply entries. A silver set (LLM-generated or engine-pinned) never does, and neither does the output of a system that orthography2ipa benchmarks against.

stress is source when the entries carry the stress marks of their source. It is rules when the source has no stress marks: the file then holds none, and the orthography2ipa stress rules place the stress on output.

How orthography2ipa uses a lexicon

The package declares one entry point per language code in the group orthography2ipa.lexicons. Each entry point loads o2i_lexicons.tsv_path, and orthography2ipa calls it with the code. The entry point only makes the lexicon discoverable. The transcription is a function of the spec and the input, never of the environment, so the caller enables the lexicon in code:

import orthography2ipa as o2i

o2i.use_packaged_lexicons()            # every installed packaged lexicon
o2i.use_packaged_lexicons(["en-GB"])   # only these
o2i.clear_lexicons()                   # disable them again

A lexicon that the caller registers with register_lexicon or set_lexicon_dir wins over a packaged one. The word_exceptions of a spec win over both. The package's own API:

import o2i_lexicons

o2i_lexicons.available_codes()     # the packaged codes
o2i_lexicons.tsv_path("en-GB")     # the TSV file for a code
o2i_lexicons.load_meta("en-GB")    # its sidecar

Packaged lexicons

Code File Source Tier Licence
en-GB o2i_lexicons/data/en-GB/wikipron.tsv WikiPron eng_latn_uk_broad.tsv, scraped from Wiktionary crowd-scraped CC BY-SA 4.0

Stress on the en-GB entries comes from the orthography2ipa rules, not from the source. WikiPron scrapes Wiktionary with stress removed ("stress": False in its data/scrape/lib/scrape.py), so the published file holds no stress mark. The sidecar records this as "stress": "rules", and the orthography2ipa stress rules mark each entry on output, as they mark an entry of word_exceptions.

Build, measure and prune

The scripts run the installed orthography2ipa. They score with the board harness of orthography2ipa at the git tag of that version, which they check out once under .cache/o2i-harness/. They read gold files from .cache/gold/.

python scripts/build_lexicon.py en-GB wikipron --report build-report.json
python scripts/measure.py en-GB ipadict:en-GB cmudict:en
python scripts/prune_check.py

build_lexicon.py keeps a word only when the rules get it wrong under the board's scoring. Words that share a spelling pattern and the same error at it form a lead. A lead is a question for the linguistic literature, not a rule. Its words stay out of the lexicon until a cited source states a rule for the pattern, or states that the pattern is lexical. The build report lists each lead.

measure.py scores a lexicon on a gold from a different source, with the rules only and with the lexicon. It refuses the gold that supplied the lexicon.

prune_check.py exits with status 1 when the rules alone now get an entry right. CI runs it on each pull request, and a weekly job removes the stale entries and opens a draft pull request.

Licence

The code is Apache-2.0. Each data file keeps the licence of its source, which its .meta.json sidecar states. The en-GB file is CC BY-SA 4.0, the licence of the Wiktionary text it comes from.

Metadata

Release files for o2i-lexicons 0.1.0a1

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

Source distribution (sdist)

Source distribution for o2i-lexicons 0.1.0a1
File Size Uploaded Provenance Actions
o2i_lexicons-0.1.0a1.tar.gz 86.9 kB Without provenance Details for o2i_lexicons-0.1.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for o2i-lexicons 0.1.0a1
File Interpreter ABI Platform Actions
o2i_lexicons-0.1.0a1-py3-none-any.whl Python 3 none any Details for o2i_lexicons-0.1.0a1-py3-none-any.whl

Total release size: 167.0 kB

Release files / o2i_lexicons-0.1.0a1.tar.gz

Download URL o2i_lexicons-0.1.0a1.tar.gz
Size 86.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e289898e1b5623e31b6f8b6b576126a4f820b162afae2dc230eec3220e1f5183
BLAKE2b-256 checksum
How to use checksums
fa9486d7076a203a5cd60da2bd9a789eedb66ed8f96fc7908589ff4c1f4a8e7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / o2i_lexicons-0.1.0a1-py3-none-any.whl

Download URL o2i_lexicons-0.1.0a1-py3-none-any.whl
Size 80.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90ad280b2828d6cb9c0c1277e420799cb29907ee7ca251599b1abc12bb715eba
BLAKE2b-256 checksum
How to use checksums
1a84d6d1dd08921d2cd6a7a534b7dc799b2e7ee48d94c925d6eb567c90b3da28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for o2i-lexicons 0.1.0a1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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