Update README #7

Merged
marvinelsen merged 2 commits from update-versions into main 2024-09-25 18:32:26 +00:00
Showing only changes of commit c95d167456 - Show all commits

View File

@ -22,7 +22,7 @@ Afterwards, add the package dependency to your `build.gradle.kts` file:
```kotlin ```kotlin
dependencies { dependencies {
implementation("com.marvinelsen:cedict-parser:1.0-SNAPSHOT") implementation("com.marvinelsen:cedict-parser:2.0.0")
} }
``` ```
@ -30,17 +30,18 @@ dependencies {
```kotlin ```kotlin
fun main() { fun main() {
val cedictInputStream = val cedictInputStream = GZIPInputStream(object {}.javaClass.getResourceAsStream("/cedict_1_0_ts_utf-8_mdbg.txt.gz")!!)
GZIPInputStream(object {}.javaClass.getResourceAsStream("/cedict_1_0_ts_utf-8_mdbg.txt.gz")!!)
val cedictParser = CedictParser.instance cedictInputStream.use {
val cedictEntries = cedictParser.parseCedict(cedictInputStream) val cedictParser = CedictParser.instance
val cedictEntries = cedictParser.parseCedict(cedictInputStream)
for (entry in cedictEntries) { cedictEntries.forEach { entry ->
println(entry.traditional) println(entry.traditional)
println(entry.simplified) println(entry.simplified)
println(entry.pinyinSyllables.joinToString(" ")) println(entry.pinyinSyllables.joinToString(" ") { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) })
println(entry.definitions.joinToString("/") { it.glosses.joinToString(";") }) println(entry.definitions.joinToString("/") { it.glosses.joinToString(";") })
}
} }
} }
``` ```