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.1.tar.gz (15.5 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.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jmdictpy-0.1.1.tar.gz
  • Upload date:
  • Size: 15.5 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.1.tar.gz
Algorithm Hash digest
SHA256 5ca6a63e10796750b64a22e5741bf1eb05d20731d8a6edb35f68667347406f16
MD5 44546e05ff1b6125b90dedd46b96489f
BLAKE2b-256 106cf443184a67ba06b6ec88b6cc1801ad88eff1d9c29f620f80fb40d8698312

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmdictpy-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: jmdictpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f63b2379cedcf6c64a0f0aa08d624343634f8a75382c099804ead45c12e19f11
MD5 d6227119dcb19e3a0b39d4e40dd03049
BLAKE2b-256 10b144621865be17ca36a3dff61e6827d4e7fe1297cdd341b1f42e7741e30297

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmdictpy-0.1.1-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