From c95d167456de6d7678b03a619615a78c78c7165c Mon Sep 17 00:00:00 2001 From: Marvin Elsen Date: Tue, 24 Sep 2024 13:22:39 +0200 Subject: [PATCH 1/2] Update README --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e65f6b0..05cee85 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Afterwards, add the package dependency to your `build.gradle.kts` file: ```kotlin dependencies { - implementation("com.marvinelsen:cedict-parser:1.0-SNAPSHOT") + implementation("com.marvinelsen:cedict-parser:2.0.0") } ``` @@ -30,17 +30,18 @@ dependencies { ```kotlin fun main() { - val cedictInputStream = - GZIPInputStream(object {}.javaClass.getResourceAsStream("/cedict_1_0_ts_utf-8_mdbg.txt.gz")!!) + val cedictInputStream = GZIPInputStream(object {}.javaClass.getResourceAsStream("/cedict_1_0_ts_utf-8_mdbg.txt.gz")!!) - val cedictParser = CedictParser.instance - val cedictEntries = cedictParser.parseCedict(cedictInputStream) + cedictInputStream.use { + val cedictParser = CedictParser.instance + val cedictEntries = cedictParser.parseCedict(cedictInputStream) - for (entry in cedictEntries) { - println(entry.traditional) - println(entry.simplified) - println(entry.pinyinSyllables.joinToString(" ")) - println(entry.definitions.joinToString("/") { it.glosses.joinToString(";") }) + cedictEntries.forEach { entry -> + println(entry.traditional) + println(entry.simplified) + println(entry.pinyinSyllables.joinToString(" ") { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) }) + println(entry.definitions.joinToString("/") { it.glosses.joinToString(";") }) + } } } ``` From d8d9ee79390ca3d17715d8ef050c59d8e7098d9c Mon Sep 17 00:00:00 2001 From: Marvin Elsen Date: Wed, 25 Sep 2024 20:29:48 +0200 Subject: [PATCH 2/2] Add build section --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 05cee85..5943d6a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,14 @@ A parser for the [CC-CEDICT](https://www.mdbg.net/chinese/dictionary?page=cedict) Chinese-to-English 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 _CC-CEDICT Parser for Kotlin_ is available