From c1a6a529e939b128144047e973278435ada2b206 Mon Sep 17 00:00:00 2001 From: hashirama Date: Tue, 22 Jul 2025 05:20:20 +0000 Subject: [PATCH] Add mdict4j_usage.java --- mdict4j_usage.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 mdict4j_usage.java diff --git a/mdict4j_usage.java b/mdict4j_usage.java new file mode 100644 index 0000000..27eb72f --- /dev/null +++ b/mdict4j_usage.java @@ -0,0 +1,14 @@ +// currently you need my fork: +// https://codeberg.org/hashirama/mdict4j + + try { + Path dictionaryPath = Paths.get("(学研)漢字源[改訂第五版].mdx"); + MDictDictionary dictionary = MDictDictionary.loadDictionary(dictionaryPath.toString()); + System.out.println(dictionary.getTitle()); + System.out.println(dictionary.getDescription()); + for (var entry : dictionary.readArticles("来")) { + System.out.printf("%s -> %s%n", entry.getKey(), entry.getValue()); + } + } catch (MDException e) { + e.printStackTrace(); + } \ No newline at end of file