Compare commits

..

No commits in common. "a176c34361907c60c7622c3a70234f70d67ffc4f" and "c6347a6b13fea83453ae133c5c3206af8a8f0f83" have entirely different histories.

View File

@ -3,14 +3,6 @@
A parser for the [CC-CEDICT](https://www.mdbg.net/chinese/dictionary?page=cedict) Chinese-to-English dictionary written A parser for the [CC-CEDICT](https://www.mdbg.net/chinese/dictionary?page=cedict) Chinese-to-English dictionary written
in [Kotlin](https://kotlinlang.org). in [Kotlin](https://kotlinlang.org).
## Build
To build the project locally, simply run the following command from the terminal:
```sh
./gradlew build
```
## Installation ## Installation
_CC-CEDICT Parser for Kotlin_ is available _CC-CEDICT Parser for Kotlin_ is available
@ -30,7 +22,7 @@ Afterwards, add the package dependency to your `build.gradle.kts` file:
```kotlin ```kotlin
dependencies { dependencies {
implementation("com.marvinelsen:cedict-parser:2.0.0") implementation("com.marvinelsen:cedict-parser:1.0-SNAPSHOT")
} }
``` ```
@ -38,19 +30,18 @@ dependencies {
```kotlin ```kotlin
fun main() { 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")!!)
cedictInputStream.use {
val cedictParser = CedictParser.instance val cedictParser = CedictParser.instance
val cedictEntries = cedictParser.parseCedict(cedictInputStream) val cedictEntries = cedictParser.parseCedict(cedictInputStream)
cedictEntries.forEach { entry -> for (entry in cedictEntries) {
println(entry.traditional) println(entry.traditional)
println(entry.simplified) println(entry.simplified)
println(entry.pinyinSyllables.joinToString(" ") { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) }) println(entry.pinyinSyllables.joinToString(" "))
println(entry.definitions.joinToString("/") { it.glosses.joinToString(";") }) println(entry.definitions.joinToString("/") { it.glosses.joinToString(";") })
} }
}
} }
``` ```