{"id":15013608,"url":"https://github.com/knifer/mdict-java","last_synced_at":"2025-10-08T12:08:23.996Z","repository":{"id":37149345,"uuid":"111713377","full_name":"KnIfER/mdict-java","owner":"KnIfER","description":"Query library for Mdict (mdx or mdd) , a popular dictionary file format. ","archived":false,"fork":false,"pushed_at":"2023-07-16T10:09:33.000Z","size":29949,"stargazers_count":173,"open_issues_count":9,"forks_count":54,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-14T12:04:45.766Z","etag":null,"topics":["dictionary","mdd","mdict-android","mdict-reader","mdx","mdxbuilder"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KnIfER.png","metadata":{"files":{"readme":"README.md","changelog":"News.md","contributing":null,"funding":null,"license":"License.txt","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":"2017-11-22T17:26:06.000Z","updated_at":"2025-06-01T21:50:59.000Z","dependencies_parsed_at":"2024-09-20T09:02:09.859Z","dependency_job_id":"bd2f6aff-b099-4220-82aa-dfa539553198","html_url":"https://github.com/KnIfER/mdict-java","commit_stats":{"total_commits":109,"total_committers":3,"mean_commits":"36.333333333333336","dds":"0.35779816513761464","last_synced_commit":"c3bc4e4fd71fc507e5b56b99394d1a5d1f941a2d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KnIfER/mdict-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnIfER%2Fmdict-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnIfER%2Fmdict-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnIfER%2Fmdict-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnIfER%2Fmdict-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KnIfER","download_url":"https://codeload.github.com/KnIfER/mdict-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnIfER%2Fmdict-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278939718,"owners_count":26072367,"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-10-08T02:00:06.501Z","response_time":56,"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":["dictionary","mdd","mdict-android","mdict-reader","mdx","mdxbuilder"],"created_at":"2024-09-24T19:44:33.841Z","updated_at":"2025-10-08T12:08:23.947Z","avatar_url":"https://github.com/KnIfER.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MDict Library in pure java ！\n\n![image](https://github.com/KnIfER/mdict-java/raw/master/screenshots/PDPC.png)  \n\nIt supports:  \n\u0026nbsp;\u0026nbsp;\u0026nbsp;I.Lzo compressed contents. (via lzo-core)  \n\u0026nbsp;\u0026nbsp;II.Ripemd128 key-info decryption.  \n\u0026nbsp;III.Builders to make Mdx add Mdd.  \n\nand is able to do:  \n\u0026nbsp;\u0026nbsp;\u0026nbsp;I.Basic query.  \n\u0026nbsp;\u0026nbsp;II.Conjuction search.  \n\u0026nbsp;III.Fast wildcard match among entries.  \n\u0026nbsp;IV.Fast Fulltext retrieval. (also with wild cards)  \n\n# Android App\nhttps://github.com/KnIfER/PlainDictionaryAPP\n\n# Usage:\n### 1.Basic query:\n```\nString key = \"happy\";\nmdict md = new mdict(path);\nint search_result = md.lookUp(key, true);//true means to match strictly  \nif(search_result\u003e=0){\n  String html_contents = md.getRecordAt(search_result);\n  String entry_name = md.getEntryAt(search_result);\n}\n```\n### 2.Search in a bunch of dicts:\n```\nkey = \"happy\";\nArrayList\u003cmdict\u003e mdxs = new ArrayList\u003c\u003e();\n...\nRBTree_additive combining_search_tree = new RBTree_additive();\nfor(int i=0;i\u003cmdxs.size();i++)\n{\n  mdxs.get(i).size_confined_lookUp(key,combining_search_tree,i,30);\n}  \t\ncombining_search_tree.inOrder();//print results stored in the RBTree\n\n/*printed results looks like 【happy____@111@0@222@1@16906@1】...【other results】...\nhow to handle:\nString html_contents0 = mdxs.get(0).getRecordAt(111);\n...\n...  \n...\n*/\n```\n\n\n# details\n* This project was initially converted from xiaoqiangWang's [python analyzer](https://bitbucket.org/xwang/mdict-analysis). \n* Use [red-black tree](http://www.cnblogs.com/skywang12345/p/3245399.html) and binary-list-searching(mainly) to implement dictionary funcitons.  \n* Feng Dihai(@[fengdh](https://github.com/fengdh/mdict-js))'s mdict-js is of help too, I've just switched to use the same short but elegant binary-list-searching method——reduce().Somehow, this function always returns the first occurence of the entry \u003e= keyword, in a pre-sorted list that contain entries. maybe some mathematician could tell me why, but I've tested over 100000 times without any expectation.\n* Maybe I should oneday replace red-black tree and the recursive reduce method with `Arrays.binarySearch`, but I am lazy... \n```\n/*via mdict-js\n *note at first time we feed in 0 as start and array.length as end. it must not be array.length-1. \n*/\npublic static int reduce(int phrase, int[] array,int start,int end) {\n\tint len = end-start;\n\tif (len \u003e 1) {\n\t  len = len \u003e\u003e 1;\n\t  return phrase \u003e array[start + len - 1]\n\t\t\t\t? reduce(phrase,array,start+len,end)\n\t\t\t\t: reduce(phrase,array,start,start+len);\n\t} else {\n\t  return start;\n\t}\n}\n```\n\t\n\t\nMDX File Format\n===============\n\u003cimg src=\"https://github.com/KnIfER/mdict-java/blob/master/screenshots/mdx.svg\"\u003e\n\n\nMDD File Format\n===============\n\u003cimg src=\"https://rawgit.com/csarron/mdict-analysis/master/MDD.svg\"\u003e\n\nSource Code License: \nApache2.0 for the core part, specifically anything under the package of com.knziha.plod.dictionary.*; GPL3.0 for everything else including the mdictBuilder, UI part, and the android application. \nAs for the License of mdx file format itself, well, you know, mdict is an open dictionary platform.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknifer%2Fmdict-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknifer%2Fmdict-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknifer%2Fmdict-java/lists"}