Skip to main content

Python library for manipulating Jim Breen's JMdict & KanjiDic2

Project description

Python library for manipulating Jim Breen’s JMdict & KanjiDic2

Main features

  • Query JMDict and KanjiDic2 in XML format directly (but slow)

  • Convert JMDict and KanjiDic2 into SQLite format for faster access

  • Basic console lookup tool

  • jamdol (jamdict-online) - REST API using Python/Flask (jamdol-flask)

Installation

pip install jamdict
# pip script sometimes doesn't work properly, so you may want to try this instead
python3 -m pip install jamdict

Data

XML files (JMdict_e.xml, kanjidic2.xml) must be downloaded from JMdict home page and copy into ~/local/jamdict/data

Read more about JMdict here: http://www.csse.monash.edu.au/~jwb/edict.html

Sample codes

>>> from jamdict import Jamdict
>>> jmd = Jamdict("/home/tuananh/local/jamdict/data/jamdict.db")
>>> jmd.lookup('食べる')
<jamdict.util.LookupResult object at 0x7fc70775a710>
>>> result = jmd.lookup('食べる')
>>> print(result.entries)
[ID:1358280|たべる|食べる|1. to eat ((Ichidan verb|transitive verb))|2. to live on (e.g. a salary)/to live off/to subsist on]
>>> for c in result.chars:
...     print(c, c.rm_groups)
...
 [R: shi2, si4, sig, , Thặcÿ, Thựcÿ, Tự,ÿ ., .らう | M: eat, drink, receive (a blow), (kokuji)]
 [R: shi2, si4, sig, sa, , , Thực, Tự, ショク, ジキ, ., .らう, .べる, . | M: eat, food, manger, nourriture, alimento, comida, eclipse, comer, comer, comida, alimento]

See jamdict_demo.py and jamdict/tools.py for more information.

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

jamdict-0.1a2.tar.gz (28.0 kB view details)

Uploaded Source

File details

Details for the file jamdict-0.1a2.tar.gz.

File metadata

  • Download URL: jamdict-0.1a2.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jamdict-0.1a2.tar.gz
Algorithm Hash digest
SHA256 f772ea2d3cc28d0abf3475789561b8081e05d1127b3b6c1c426b0b24d86df2e4
MD5 e3174a069d7531c14906cddc2134e6dd
BLAKE2b-256 c3c2c8bd555b1c3824c9aab79966a09b2af4593c8662b2122b7bb2f818daf8ac

See more details on using hashes here.

Supported by

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