Jamdict’s documentation!

Jamdict is a Python 3 library for manipulating Jim Breen’s JMdict, KanjiDic2, JMnedict and kanji-radical mappings.

Welcome

Are you new to this documentation? Here are some useful pages:

Main features

  • Support querying different Japanese language resources

    • Japanese-English dictionary JMDict

    • Kanji dictionary KanjiDic2

    • Kanji-radical and radical-kanji maps KRADFILE/RADKFILE

    • Japanese Proper Names Dictionary (JMnedict)

  • Fast look up (dictionaries are stored in SQLite databases)

  • Command-line lookup tool (Example)

Contributors are welcome! 🙇. If you want to help developing Jamdict, please visit Contributing page.

Installation

Jamdict and jamdict-data are both available on PyPI and can be installed using pip. For more information please see Installation page.

pip install jamdict jamdict-data

Also, there is an online demo Jamdict virtual machine to try out on Repl.it

https://replit.com/@tuananhle/jamdict-demo

Sample jamdict Python code

Looking up words

>>> from jamdict import Jamdict
>>> jam = Jamdict()
>>> result = jam.lookup('はな')
>>> for word in result.entries:
...     print(word)
...
[id#1194500] はな (花) : 1. flower/blossom/bloom/petal ((noun (common) (futsuumeishi))) 2. cherry blossom 3. beauty 4. blooming (esp. of cherry blossoms) 5. ikebana 6. Japanese playing cards 7. (the) best
[id#1486720] はな (鼻) : nose ((noun (common) (futsuumeishi)))
[id#1581610] はし (端) : 1. end (e.g. of street)/tip/point/edge/margin ((noun (common) (futsuumeishi))) 2. beginning/start/first 3. odds and ends/scrap/odd bit/least
[id#1634180] はな (洟) : snivel/nasal mucus/snot ((noun (common) (futsuumeishi)))

Looking up kanji characters

>>> for c in result.chars:
...     print(repr(c))
...
花:7:flower
華:10:splendor,flower,petal,shine,luster,ostentatious,showy,gay,gorgeous
鼻:14:nose,snout
端:14:edge,origin,end,point,border,verge,cape
洟:9:tear,nasal discharge

Looking up named entities

>>> result = jam.lookup('ディズニー%')
>>> for name in result.names:
...     print(name)
...
[id#5053163] ディズニー : Disney (family or surname/company name)
[id#5741091] ディズニーランド : Disneyland (place name)

See Common Recipes for more code samples.

Command line tools

Jamdict can be used from the command line.

python3 -m jamdict lookup 言語学
========================================
Found entries
========================================
Entry: 1264430 | Kj:  言語学 | Kn: げんごがく
--------------------
1. linguistics ((noun (common) (futsuumeishi)))

========================================
Found characters
========================================
Char: 言 | Strokes: 7
--------------------
Readings: yan2, eon, 언, Ngôn, Ngân, ゲン, ゴン, い.う, こと
Meanings: say, word
Char: 語 | Strokes: 14
--------------------
Readings: yu3, yu4, eo, 어, Ngữ, Ngứ, ゴ, かた.る, かた.らう
Meanings: word, speech, language
Char: 学 | Strokes: 8
--------------------
Readings: xue2, hag, 학, Học, ガク, まな.ぶ
Meanings: study, learning, science

No name was found.

To show help you may use

python3 -m jamdict --help