Python bindings for mdict-rs: A fast MDict dictionary format parser
Project description
mdict-rs
This project provides Python bindings via PyO3, allowing you to use the fast Rust MDict parser from Python code.
How to build
# Install maturin for building Python extensions
python3 -m venv .venv && source .venv/bin/activate && pip install maturin
# Build and install the Python package
maturin develop --release
Usage
import mdict_rs
# Parse from file
mdx = mdict_rs.parse_mdx_file("dictionary.mdx")
# Parse from bytes
with open("dictionary.mdx", "rb") as f:
data = f.read()
mdx = mdict_rs.parse_mdx_bytes(data)
# Get all entries
records = mdx.items()
for record in records:
print(f"{record.text}: {record.definition}")
# Get total count
count = mdx.get_entries_count()
print(f"Total entries: {count}")
Building for PyPI
# Build wheels for distribution
maturin build --release
# Publish to PyPI (requires API token)
maturin publish
Screenshot
References
MDX的解析功能和mdx文件规范参考mdict-analysis 和文章MDX/MDD 文件格式解析
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
mdict_rs-0.1.0.tar.gz
(13.7 MB
view details)
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 mdict_rs-0.1.0.tar.gz.
File metadata
- Download URL: mdict_rs-0.1.0.tar.gz
- Upload date:
- Size: 13.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4af852317da67b220bd7c22d964c9f56599938cabcef75b9d5d22d58dabf3f77
|
|
| MD5 |
0f6558d7d8824e8c971cb8a31c6d2461
|
|
| BLAKE2b-256 |
0f7581ad467c52ce66a48441ead7c9add654721cf97586440866309a2c68e28b
|
File details
Details for the file mdict_rs-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: mdict_rs-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
168af179818ee3033c3da6086e2fe18bb2e10587fd99fc958c72ac1864b59d2f
|
|
| MD5 |
f7bbdf5d47fab92674fcff3ebfb1db4e
|
|
| BLAKE2b-256 |
1dfa441d6a754247f174375a4728b04835f7ec1b42763479fc8f9e175654844e
|