A parser for the Moedict (教育部重編國語辭典) Chinese-to-Chinese dictionary
Go to file
Marvin Elsen 0d488348f0
All checks were successful
Publish package / publish (push) Successful in 2m26s
Initial commit
2024-10-09 21:50:18 +02:00
.gitea/workflows Initial commit 2024-10-09 21:50:18 +02:00
gradle Initial commit 2024-10-09 21:50:18 +02:00
src Initial commit 2024-10-09 21:50:18 +02:00
.gitignore Initial commit 2024-10-09 21:50:18 +02:00
build.gradle.kts Initial commit 2024-10-09 21:50:18 +02:00
gradle.properties Initial commit 2024-10-09 21:50:18 +02:00
gradlew Initial commit 2024-10-09 21:50:18 +02:00
gradlew.bat Initial commit 2024-10-09 21:50:18 +02:00
LICENSE Initial commit 2024-10-09 21:50:18 +02:00
README.md Initial commit 2024-10-09 21:50:18 +02:00
settings.gradle.kts Initial commit 2024-10-09 21:50:18 +02:00

Moedict (教育部重編國語辭典) Parser for Kotlin

A parser for the Moedict (教育部重編國語辭典) Chinese-to-Chinese dictionary written in Kotlin.

Build

To build the project locally, simply run the following command from the terminal:

./gradlew build

Installation

Moedict (教育部重編國語辭典) Parser for Kotlin is available from my self-hosted Gitea instance.

First, add the repository to your build.gradle.kts file:

repositories {
    maven {
        url = uri("https://gitea.marvinelsen.com/api/packages/marvinelsen/maven")
    }
}

Afterwards, add the package dependency to your build.gradle.kts file:

dependencies {
    implementation("com.marvinelsen:moedict-parser:1.0.0")
}

Usage

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, unless otherwise noted.

To the following third-party code, data, and files in the repository different licenses apply:

Moedict (教育部重編國語辭典

Moedict (教育部重編國語辭典) provided by the 教育部 is licensed under a CC BY-ND 3.0 TW.