Compare commits
3 Commits
c6347a6b13
...
a176c34361
Author | SHA1 | Date | |
---|---|---|---|
a176c34361 | |||
d8d9ee7939 | |||
c95d167456 |
19
README.md
19
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
|
||||
@ -22,7 +30,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,18 +38,19 @@ 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")!!)
|
||||
|
||||
cedictInputStream.use {
|
||||
val cedictParser = CedictParser.instance
|
||||
val cedictEntries = cedictParser.parseCedict(cedictInputStream)
|
||||
|
||||
for (entry in cedictEntries) {
|
||||
cedictEntries.forEach { entry ->
|
||||
println(entry.traditional)
|
||||
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(";") })
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user