Python bindings for the Panini morphological extraction engine.
Project description
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
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 Distributions
Built Distributions
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 panini_lang-0.1.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: panini_lang-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcf4928738c010468ecdc9741cf319cb6c5295fe9aca4fc5446082bb695586ac
|
|
| MD5 |
ca4fb6275ee6340b24ece420f204df90
|
|
| BLAKE2b-256 |
7d1d2e972ef15bea5ae4bb3b9c7e94170f81bc7d0705f57355b02b70e13b85a2
|
Provenance
The following attestation bundles were made for panini_lang-0.1.0-cp38-abi3-win_amd64.whl:
Publisher:
publish-panini-lang.yml on yro7/panini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panini_lang-0.1.0-cp38-abi3-win_amd64.whl -
Subject digest:
fcf4928738c010468ecdc9741cf319cb6c5295fe9aca4fc5446082bb695586ac - Sigstore transparency entry: 1252933192
- Sigstore integration time:
-
Permalink:
yro7/panini@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/yro7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-panini-lang.yml@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panini_lang-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: panini_lang-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 6.6 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5da0c4c161f89ed90e64c36e4c283379d80e761276756d646fdb262f9f1a6b4c
|
|
| MD5 |
95f063cb56ce16fdb5988fd92cb33c78
|
|
| BLAKE2b-256 |
1482f4e6714987b3c31f84dcd7604fdccd324e28b7228b7aac09b434ff6015cf
|
Provenance
The following attestation bundles were made for panini_lang-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish-panini-lang.yml on yro7/panini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panini_lang-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
5da0c4c161f89ed90e64c36e4c283379d80e761276756d646fdb262f9f1a6b4c - Sigstore transparency entry: 1252933235
- Sigstore integration time:
-
Permalink:
yro7/panini@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/yro7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-panini-lang.yml@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panini_lang-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: panini_lang-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c11b69baeb0a22610b4af769b48c1bc63e6a6e88bdc03f069d729280ca605d10
|
|
| MD5 |
6758d914ecce0d1ab0f78bc27619f295
|
|
| BLAKE2b-256 |
b9ad6758f257c986fd3385e8a0475a8625352dab978b39b19b0aad968226c9bd
|
Provenance
The following attestation bundles were made for panini_lang-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
publish-panini-lang.yml on yro7/panini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panini_lang-0.1.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
c11b69baeb0a22610b4af769b48c1bc63e6a6e88bdc03f069d729280ca605d10 - Sigstore transparency entry: 1252933166
- Sigstore integration time:
-
Permalink:
yro7/panini@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/yro7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-panini-lang.yml@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Trigger Event:
push
-
Statement type:
File details
Details for the file panini_lang-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: panini_lang-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64d9688af59aa4dbeec591653263d78521c28bbfd3752b812314bcd1eab5e238
|
|
| MD5 |
75d28010796b2e7547c197b5cb5baff2
|
|
| BLAKE2b-256 |
2e3ffbbee1d0a5b00b2e71774387076d0dfe858ac8fd87e228658c3c082f3102
|
Provenance
The following attestation bundles were made for panini_lang-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish-panini-lang.yml on yro7/panini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panini_lang-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl -
Subject digest:
64d9688af59aa4dbeec591653263d78521c28bbfd3752b812314bcd1eab5e238 - Sigstore transparency entry: 1252933126
- Sigstore integration time:
-
Permalink:
yro7/panini@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/yro7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-panini-lang.yml@c4e8d18183523d7a9569b64f2c2807a53614aa54 -
Trigger Event:
push
-
Statement type: