panini-lang
Python bindings for Panini — an LLM-powered morphological feature extraction engine for any language.
Installation
pip install panini-lang
No other dependencies required. The package ships pre-compiled for macOS, Linux, and Windows.
Quick Start
from panini import extract
result = extract(
provider="openai", # "openai" | "anthropic" | "google"
model="gpt-4o",
api_key="sk-...",
language="fra", # ISO 639-3 code
text="Je ne sais pas",
targets=["sais"],
)
print(result)
# {
# "target_features": [...],
# "context_features": [...]
# }
Async Support
import asyncio
from panini import async_extract
async def main():
result = await async_extract(
provider="anthropic",
model="claude-opus-4-5",
api_key="sk-ant-...",
language="pol",
text="Nie wiem",
targets=["wiem"],
)
print(result)
asyncio.run(main())
Supported Languages
from panini import supported_languages
supported_languages()
# ['pol', 'tur', 'ara', 'fra']
| Code | Language |
|---|---|
pol |
Polish |
tur |
Turkish |
ara |
Arabic |
fra |
French |
Supported Providers
| Provider | provider= value |
Example model |
|---|---|---|
| OpenAI | "openai" |
"gpt-4o" |
| Anthropic | "anthropic" |
"claude-opus-4-5" |
"google" |
"gemini-2.0-flash" |
Analysis Components
By default, all compatible components are run. You can select specific ones:
result = extract(
...,
components=["morphology", "pedagogical_explanation"],
)
| Key | Description |
|---|---|
morphology |
POS tag, lemma, case/tense/gender/etc. |
pedagogical_explanation |
HTML explanation for language learners |
multiword_expressions |
Idioms, collocations, phrasal verbs |
morpheme_segmentation |
Morpheme-by-morpheme breakdown (agglutinative languages only) |
leipzig_alignment |
Leipzig-style interlinear glossing |
Custom Prompts
Panini ships with built-in extraction prompts. You can override them by passing a YAML file path or a dict:
# From a YAML file
result = extract(..., prompts="/path/to/my_prompts.yml")
# From a dict
result = extract(..., prompts={
"system_role": "You are a strict NLP extractor...",
...
})
# Inspect the built-in default prompts
from panini import get_default_prompts
print(get_default_prompts())
Full API Reference
extract(...) -> dict
Synchronous extraction.
| Parameter | Type | Default | Description |
|---|---|---|---|
provider |
str |
required | LLM provider: "openai", "anthropic", "google" |
model |
str |
required | Model name (e.g. "gpt-4o") |
api_key |
str |
required | Provider API key |
language |
str |
required | ISO 639-3 language code |
text |
str |
required | Sentence to analyse |
targets |
list[str] |
required | Target words to extract features for |
prompts |
str | dict | None |
None |
Path to YAML, dict, or None for built-in defaults |
temperature |
float |
0.2 |
LLM temperature |
max_tokens |
int |
4096 |
Max output tokens |
ui_language |
str |
"English" |
Language for pedagogical explanations |
components |
list[str] | None |
None |
Components to run (all if None) |
async_extract(...) -> dict
Asynchronous version of extract(). Same parameters, returns a coroutine.
supported_languages() -> list[str]
Returns the list of supported ISO 639-3 language codes.
get_default_prompts() -> dict
Returns the built-in extraction prompts as a Python dict.
version() -> str
Returns the current package version.
License
MIT
Metadata
Release files for panini-lang 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| panini_lang-0.2.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| panini_lang-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| panini_lang-0.2.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| panini_lang-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 28.8 MB
Release files / panini_lang-0.2.0-cp38-abi3-win_amd64.whl
| Download URL | panini_lang-0.2.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fb7d2a695ea9adeec21bac4350375507431d8ca885db10b6f3a995a4da42443e
|
|
BLAKE2b-256 checksum How to use checksums |
08d5fc0508fa6826b6ebe7d4344a849263ecab9d9ca2f6d9e35318adab6f6a48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 12, 2026.
Transparency logRelease files / panini_lang-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | panini_lang-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 7.9 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
15d169bcfdf43429018a1030d6bb042c6555d936396bd54467eb07135d3288de
|
|
BLAKE2b-256 checksum How to use checksums |
2b80f3fcd9d7643d4e91ef0aa248b167c376bd2d68080ca7869fa26979e257db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 12, 2026.
Transparency logRelease files / panini_lang-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | panini_lang-0.2.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.2 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7e3ffa988204ec7451ecfd81a358532f67a86fa5cc8c03a79029ed3bfd291393
|
|
BLAKE2b-256 checksum How to use checksums |
45ef911600ff41d5940b04a0872ad61883dc9404b1ed35ae11968eb6db3c488e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 12, 2026.
Transparency logRelease files / panini_lang-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | panini_lang-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 7.4 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
4ef015d2659463be310bc4a4ca4bef299ce13ca55cafe310bf646c9a77333cc7
|
|
BLAKE2b-256 checksum How to use checksums |
fd84f54a924daac86c70d4bb43652bd7148b1c092a66e03fd6f853cd6162efbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 12, 2026.
Transparency log