Skip to main content

conlangkit

CI CodeQL PyPI Python versions License

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.syllables currently raises NotImplementedError; call syllable.candidates() directly if you need phonotactic syllable generation.

Name note: the import package is conlangkit. It is unrelated to the langkit project 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)

# Searching prose? Fold case — lemma matching stays byte-exact by default
hits = g.find("d:Fruit", ignore_case=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

Apache-2.0.

Release files for conlangkit 0.3.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 conlangkit 0.3.0
File Size Uploaded
conlangkit-0.3.0.tar.gz 53.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for conlangkit 0.3.0
File Interpreter ABI Platform
conlangkit-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 115.3 kB

Release files / conlangkit-0.3.0.tar.gz

Download URL conlangkit-0.3.0.tar.gz
Size 53.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1babe65e9c90fa603154d4a5828641d618e18556fb74de5104f75b3b24acb4c0
BLAKE2b-256 checksum
How to use checksums
3abbb0c1f327f1e9f171e62898060faf7ae15ccba5e7f4251d449889d29ba799
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 30, 2026.

Transparency log

Release files / conlangkit-0.3.0-py3-none-any.whl

Download URL conlangkit-0.3.0-py3-none-any.whl
Size 61.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90cb8951f54e5f166891229f184b735e1c5328b3a5330e2276750fff912d72d8
BLAKE2b-256 checksum
How to use checksums
b5dad6fd602327bfc02609c7996a82b06360ece804328bf22b09953261b14bee
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 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 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