{"id":15960315,"url":"https://github.com/cdpath/mdict-analysis","last_synced_at":"2025-08-11T13:09:21.207Z","repository":{"id":155839913,"uuid":"120285757","full_name":"cdpath/mdict-analysis","owner":"cdpath","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-05T09:52:21.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T10:59:59.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdpath.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-05T09:52:03.000Z","updated_at":"2018-02-05T09:52:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"89ae7a60-faab-49c1-ae20-460abf492c97","html_url":"https://github.com/cdpath/mdict-analysis","commit_stats":{"total_commits":71,"total_committers":7,"mean_commits":"10.142857142857142","dds":"0.45070422535211263","last_synced_commit":"70ee45bdfbcf253b4ed7eb1626d9ffc6d1b4b3e0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cdpath/mdict-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdpath%2Fmdict-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdpath%2Fmdict-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdpath%2Fmdict-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdpath%2Fmdict-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdpath","download_url":"https://codeload.github.com/cdpath/mdict-analysis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdpath%2Fmdict-analysis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269892088,"owners_count":24491857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-07T15:02:02.323Z","updated_at":"2025-08-11T13:09:21.177Z","avatar_url":"https://github.com/cdpath.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"An Analysis of MDX/MDD File Format\r\n==================================\r\n\r\n    MDict is a multi-platform open dictionary\r\n    \r\nwhich are both questionable. It is not available for every platform, e.g. OS X, Linux.\r\nIts  dictionary file format is not open. But this has not hindered its popularity,\r\nand many dictionaries have been created for it.\r\n\r\nThis is an attempt to reveal MDX/MDD file format, so that my favorite dictionaries,\r\ncreated by MDict users, could be used elsewhere.\r\n\r\n\r\nMDict Files\r\n===========\r\nMDict stores the dictionary definitions, i.e. (key word, explanation) in MDX file and\r\nthe dictionary reference data, e.g. images, pronunciations, stylesheets in MDD file.\r\nAlthough holding different contents, these two file formats share the same structure.\r\n\r\nMDX File Format\r\n===============\r\n.. image:: MDX.svg\r\n\r\n\r\nMDD File Format\r\n===============\r\n.. image:: MDD.svg\r\n\r\nExample Programs\r\n================\r\n\r\nreadmdict.py\r\n------------\r\nreadmdict.py is an example implementation in Python. This program can read/extract mdx/mdd files.\r\n\r\n.. note:: python-lzo is required to read mdx files created with engine 1.2.\r\n   Get Windows version from http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-lzo\r\n\r\nIt can be used as a command line tool. Suppose one has oald8.mdx and oald8.mdd::\r\n\r\n    $ python readmdict.py -x oald8.mdx\r\n\r\nThis will creates *oald8.txt* dictionary file and creates a folder *data* for images, pronunciation audio files.\r\n\r\nOn Windows, one can also double click it and select the file in the popup dialog.\r\n\r\nOr as a module::\r\n\r\n    In [1]: from readmdict import MDX, MDD\r\n\r\nRead MDX file and print the first entry::\r\n\r\n    In [2]: mdx = MDX('oald8.mdx')\r\n\r\n    In [3]: items = mdx.items()\r\n\r\n    In [4]: items.next()\r\n    Out[4]:\r\n    ('A',\r\n     '\u003cspan style=\\'display:block;color:black;\\'\u003e.........')\r\n``mdx`` is an object having all info from a MDX file. ``items`` is an iterator producing 2-item tuples.\r\nOf each tuple, the first element is the entry text and the second is the explanation. Both are UTF-8 encoded strings.\r\n\r\nRead MDD file and print the first entry::\r\n\r\n    In [5]: mdd = MDD('oald8.mdd')\r\n\r\n    In [6]: items = mdd.items()\r\n\r\n    In [7]: items = mdd.next()\r\n    Out[7]: \r\n    (u'\\\\pic\\\\accordion_concertina.jpg',\r\n    '\\xff\\xd8\\xff\\xe0\\x00\\x10JFIF...........')\r\n\r\n``mdd`` is an object having all info from a MDD file. ``items`` is an iterator producing 2-item tuples. \r\nOf each tuple, the first element is the file name and the second element is the corresponding file content.\r\nThe file name is encoded in UTF-8. The file content is a plain bytes array.\r\n\r\nAcknowledge\r\n===========\r\nThe file format gets fully disclosed by https://github.com/zhansliu/writemdict.\r\nThe encryption part is taken into this project.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdpath%2Fmdict-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdpath%2Fmdict-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdpath%2Fmdict-analysis/lists"}