A Python toolkit for building constructed languages: glossary format & search, base-form reduction, POS tagging, and orthography.
Project description
conlangkit
A Python toolkit for building constructed languages. It provides a glossary
format and search engine, base-form reduction for English, part-of-speech
tagging integration, an orthography transliterator, and phoneme/syllable
primitives — plus a clk command-line tool for working with a language on disk.
Experimental: the phonotactic features (
syllable.candidates,Lang.syllables) are partially implemented.Lang.syllablescurrently raisesNotImplementedError; callsyllable.candidates()directly if you need phonotactic syllable generation.
Name note: the import package is
conlangkit. It is unrelated to thelangkitproject on PyPI (WhyLabs' LLM-monitoring library).
Install
pip install conlangkit # or: uv add conlangkit
This installs the library and the clk command-line tool.
Quick example
from conlangkit.glossary import Glossary
g = Glossary.load("path/to/glossary.md")
print(f"{g.lemma_count} entries loaded")
# Find entries whose definition contains "fruit"
for entry in g.find("d:*fruit", max_hits=10):
print(entry.lemma, "—", entry.defn)
# Fuzzy search across lemma and definition
hits = g.find("apple", try_fuzzy=True)
Glossary files are Markdown tables with four pipe-delimited columns —
lemma | tags | definition | notes — and may have arbitrary Markdown before and
after the table. See ARCHITECTURE.md for the full format.
Command-line tool
clk <LANGDIR> repl # interactive REPL over the language in <LANGDIR>
clk <LANGDIR> # defaults to the repl
clk help # general help
<LANGDIR> is a directory containing a language (cfg.json + glossary.md).
Public API
The supported surface (imported directly from its submodule):
| Name | Module | Purpose |
|---|---|---|
Glossary |
conlangkit.glossary |
Load, save, and search a glossary file |
Entry |
conlangkit.glossary |
A single glossary entry (lemma, tags, defn, notes) |
Defn / DefnItem |
conlangkit.glossary |
Parsed definition with multiple equivalences |
SearchExpr / MatchExpr |
conlangkit.glossary |
Search-expression objects |
Lang |
conlangkit.lang |
Language object: config + glossary + phonology |
TranslationCoach / rewrite_rules |
conlangkit.tcoach |
Hint-based translation assistant |
bfr |
conlangkit.bfr |
Base-form reduction (inflected English → lemma) |
find_by_nltk |
conlangkit.pos |
Map an NLTK POS tag to a conlangkit POS |
Orthography |
conlangkit.ortho |
Bidirectional transliteration |
Syllable / candidates |
conlangkit.syllable |
Phonotactic primitives (experimental) |
Phoneme / ByIPA / ByXSampa |
conlangkit.phoneme |
IPA phoneme inventory (experimental) |
The package ships a py.typed marker, so type checkers see its annotations.
Developer quickstart
Prerequisite: uv.
git clone https://github.com/dhh1128/conlangkit
cd conlangkit
uv sync # create .venv from uv.lock (incl. dev tools)
# One-time: fetch the NLTK corpora the tests use
uv run python -c "import nltk; [nltk.download(p, quiet=True) for p in \
['punkt','punkt_tab','averaged_perceptron_tagger','averaged_perceptron_tagger_eng','wordnet']]"
uv run pytest # tests + coverage
uv run ruff check . # lint
uv run mypy # type-check
uv run pre-commit install # enable pre-commit hooks (once)
See CONTRIBUTING.md for the contribution workflow and AGENTS.md for the conventions AI agents and developers follow here.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file conlangkit-0.1.0.tar.gz.
File metadata
- Download URL: conlangkit-0.1.0.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4d1eb94a25251bea65369e275af1272dfe1c09a3a0d04831c487ebad75b89ed
|
|
| MD5 |
54661110f7dcb77083ff93e655eea570
|
|
| BLAKE2b-256 |
671c659ccedbcb329321eca34ce82e9e2252273a15f6ff6dcd27025a4f8d904f
|
Provenance
The following attestation bundles were made for conlangkit-0.1.0.tar.gz:
Publisher:
release.yml on dhh1128/conlangkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conlangkit-0.1.0.tar.gz -
Subject digest:
b4d1eb94a25251bea65369e275af1272dfe1c09a3a0d04831c487ebad75b89ed - Sigstore transparency entry: 2251781424
- Sigstore integration time:
-
Permalink:
dhh1128/conlangkit@4f10a58b9e3ef588bcda2c0bc11de78bd51f435f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dhh1128
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4f10a58b9e3ef588bcda2c0bc11de78bd51f435f -
Trigger Event:
push
-
Statement type:
File details
Details for the file conlangkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: conlangkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 59.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e35f876f248ac776214b9fce7c4985e8bf54228e29adb096e516bd7ca630f873
|
|
| MD5 |
e32615231c6f5abb47cb00f0260f895c
|
|
| BLAKE2b-256 |
c7b939fe8de13d6ecc9661633ff63b53337cc0b6494daa91e7664824f077aa90
|
Provenance
The following attestation bundles were made for conlangkit-0.1.0-py3-none-any.whl:
Publisher:
release.yml on dhh1128/conlangkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conlangkit-0.1.0-py3-none-any.whl -
Subject digest:
e35f876f248ac776214b9fce7c4985e8bf54228e29adb096e516bd7ca630f873 - Sigstore transparency entry: 2251781896
- Sigstore integration time:
-
Permalink:
dhh1128/conlangkit@4f10a58b9e3ef588bcda2c0bc11de78bd51f435f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dhh1128
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4f10a58b9e3ef588bcda2c0bc11de78bd51f435f -
Trigger Event:
push
-
Statement type: