Skip to main content

Fast Python wrapper for JMdict with SQLite backend and automatic updates

Project description

JMdictPy

Fast Python wrapper for jmdict-simplified with SQLite backend and automatic updates.

Features

  • 🚀 Fast lookups - SQLite with indexed queries (sub-millisecond)
  • 🔄 Auto-updates - Checks for new releases on initialization
  • 🌍 Multi-language - Supports 10 languages (eng, ger, rus, hun, dut, spa, fre, swe, slv)
  • 📦 Zero config - Downloads and builds database automatically
  • 🔍 Full-text search - FTS5 for meaning/gloss searches
  • 📚 Complete coverage - JMdict, JMnedict (names), Kanjidic (characters)

Installation

pip install jmdictpy

Or install from source:

git clone https://github.com/your-username/jmdictpy
cd jmdictpy
pip install -e .

Quick Start

from jmdictpy import JMDict

# Initialize (downloads ~11MB on first run)
jmd = JMDict()

# Lookup by kanji/kana
result = jmd.lookup("食べる")
for entry in result.entries:
    print(entry)
# 食べる【たべる】: to eat; to live on

# Lookup by reading
entries = jmd.lookup_by_reading("たべる")

# Search by meaning (full-text search)
entries = jmd.search("to eat")

# Lookup kanji character
char = jmd.lookup_character("食")
print(f"{char.literal}: {char.meanings}")
# 食: ['eat', 'food']

# Lookup names (JMnedict)
names = jmd.lookup_name("田中")

API Reference

JMDict Class

JMDict(
    db_path=None,       # Custom database path (default: ~/.jmdictpy/jmdict.db)
    language="eng",     # Translation language
    auto_update=True,   # Check for updates on init
    memory_mode=False,  # Load DB into RAM for faster queries
    common_only=False,  # Only download common words
)

Methods

Method Description
lookup(query) Main search - finds entries by kanji, kana, or meaning
lookup_by_reading(reading) Search by kana reading only
lookup_by_meaning(meaning) Exact match on translation
search(query) Full-text search on meanings
lookup_by_id(id) Get entry by JMdict ID
lookup_name(text) Search JMnedict for names
lookup_character(char) Get Kanjidic info for a kanji
check_for_updates() Check if new version available
update() Download and install latest version

Data Models

@dataclass
class Entry:
    id: str
    kanji: list[Kanji]      # Kanji writings
    kana: list[Kana]        # Kana readings
    senses: list[Sense]     # Meanings/translations

@dataclass
class Sense:
    part_of_speech: list[str]
    glosses: list[Gloss]    # Translations
    fields: list[str]       # Field of use (math, comp, etc.)
    dialect: list[str]
    misc: list[str]

@dataclass
class LookupResult:
    entries: list[Entry]        # JMdict entries
    names: list[NameEntry]      # JMnedict names
    characters: list[Character] # Kanjidic characters

Configuration

Environment Variables

Variable Description
JMDICTPY_DATA_DIR Custom data directory (default: ~/.jmdictpy)

Languages

Supported language codes (ISO 639-2):

  • eng - English
  • ger - German
  • rus - Russian
  • hun - Hungarian
  • dut - Dutch
  • spa - Spanish
  • fre - French
  • swe - Swedish
  • slv - Slovenian
  • all - All languages

Updates

JMdictPy checks for updates from jmdict-simplified releases automatically.

# Check current version
print(jmd.version)  # 3.6.1+20251229123436

# Check for updates
local, remote, available = jmd.check_for_updates()

# Update to latest
jmd.update()

License

MIT License

Dictionary data from JMdict by the Electronic Dictionary Research and Development Group, used under EDRDG License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jmdictpy-0.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jmdictpy-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file jmdictpy-0.1.0.tar.gz.

File metadata

  • Download URL: jmdictpy-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jmdictpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8d9af8b97a900a70482348fbe0674c0595ce648a6186594c6fc09b2fc5c28a4b
MD5 5d7b00f64f4e5f4fd3319a46dad7eff4
BLAKE2b-256 6a0c18982a34659e24ed36dfe4b7279cf305a014130180de238d10d56bba6cfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmdictpy-0.1.0.tar.gz:

Publisher: publish.yml on msr2903/jmdictpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jmdictpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jmdictpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jmdictpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cacbfd2f7c0759d18db970c210da1937875af317713c321306df61a4a60b5604
MD5 9c473fa868afc1bd83da9ce3aecbb8d7
BLAKE2b-256 b867a87296e76792093cff3b3b3634ee731395405031793c7e503ed3c09c343e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmdictpy-0.1.0-py3-none-any.whl:

Publisher: publish.yml on msr2903/jmdictpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page