# Moedict (教育部重編國語辭典) Parser for Kotlin A parser for the [Moedict (教育部重編國語辭典)](https://github.com/g0v/moedict-data) Chinese-to-Chinese dictionary written in [Kotlin](https://kotlinlang.org). ## Build To build the project locally, simply run the following command from the terminal: ```sh ./gradlew build ``` ## Installation _Moedict (教育部重編國語辭典) Parser for Kotlin_ is available from [my self-hosted Gitea instance](https://gitea.marvinelsen.com/marvinelsen/cedict-parser). First, add the repository to your `build.gradle.kts` file: ```kotlin repositories { maven { url = uri("https://gitea.marvinelsen.com/api/packages/marvinelsen/maven") } } ``` Afterwards, add the package dependency to your `build.gradle.kts` file: ```kotlin dependencies { implementation("com.marvinelsen:moedict-parser:1.0.0") } ``` ## Usage ```kotlin fun main() { val moedictInputStream = GZIPInputStream(object {}.javaClass.getResourceAsStream("/moedict.json.gz")!!) moedictInputStream.use { val moedictParser = MoedictParser.instance val moedictEntries = moedictParser.parse(moedictInputStream) moedictEntries.forEach { entry -> println(entry.title) entry.heteronyms.forEach { heteronym -> println(heteronym.zhuyin) heteronym.definitions.forEach { definition -> println(definition.definition) println(definition.examples) } } } } } ``` ## License All source code in this repository is licensed under a [MIT license](LICENSE), unless otherwise noted. To the following third-party code, data, and files in the repository different licenses apply: ### Moedict (教育部重編國語辭典 [Moedict (教育部重編國語辭典)](https://github.com/g0v/moedict-data) provided by the [教育部](https://dict.revised.moe.edu.tw) is licensed under a [CC BY-ND 3.0 TW](https://creativecommons.org/licenses/by-nd/3.0/tw/).