A parser for the Cross-straits (兩岸詞典) Chinese-to-Chinese dictionary
Go to file
Marvin Elsen 50416cc7a5
All checks were successful
Publish package / publish (push) Successful in 1m36s
Fix incorrect license
2024-10-09 18:20:19 +02:00
.gitea/workflows Initial commit 2024-10-09 18:07:08 +02:00
gradle Initial commit 2024-10-09 18:07:08 +02:00
src Fix incorrect license 2024-10-09 18:20:19 +02:00
.gitignore Initial commit 2024-10-09 18:07:08 +02:00
build.gradle.kts Fix incorrect license 2024-10-09 18:20:19 +02:00
gradle.properties Initial commit 2024-10-09 18:07:08 +02:00
gradlew Initial commit 2024-10-09 18:07:08 +02:00
gradlew.bat Initial commit 2024-10-09 18:07:08 +02:00
LICENSE Initial commit 2024-10-09 18:07:08 +02:00
README.md Fix incorrect license 2024-10-09 18:20:19 +02:00
settings.gradle.kts Initial commit 2024-10-09 18:07:08 +02:00

Cross-straits (兩岸詞典) Parser for Kotlin

A parser for the Cross-straits (兩岸詞典) Chinese-to-Chinese dictionary written in Kotlin.

Build

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

./gradlew build

Installation

Cross-straits (兩岸詞典) 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:cross-straits-parser:1.0.1")
}

Usage

fun main() {
    val crossStraitsInputStream = GZIPInputStream(object {}.javaClass.getResourceAsStream("/cross-straits.csv.gz")!!)

    crossStraitsInputStream.use {
        val crossStraitsParser = CrossStraitsParser.instance
        val crossStraitsEntries = crossStraitsParser.parse(crossStraitsInputStream)

        crossStraitsEntries.forEach { entry ->
            println(entry.traditional)
            println(entry.simplified)
            println(entry.pronunciationTaiwan.joinToString(" ") { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) })
            println(entry.pronunciationMainland.joinToString(" ") { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) })
            println(entry.definitions.first().definition)
            println(entry.definitions.first().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:

Cross-straits (兩岸詞典) Dictionary

Cross-Straits Dictionary (兩岸詞典) provided by the 中華文化總會 is licensed under a CC BY-NC-ND 3.0 TW.