Add readme
All checks were successful
Pull Request / build (pull_request) Successful in 1m54s

This commit is contained in:
Marvin Elsen 2024-09-15 15:55:19 +02:00
parent 38767703ce
commit b3164155e8
Signed by: marvinelsen
GPG Key ID: 820672408CC318C2

54
README.md Normal file
View File

@ -0,0 +1,54 @@
# CC-CEDICT Parser for Kotlin
A parser for the [CC-CEDICT](https://www.mdbg.net/chinese/dictionary?page=cedict) written in [Kotlin](https://kotlinlang.org).
## Installation
_CC-CEDICT Parser for Kotlin_ is available
from [my self-hosted Gitea instance](https://gitea.marvinelsen.com/marvinelsen/cedict-parser).
First, add the repository to your `build.gradle.kts` file:
```kotlin
repositories {
maven {
url = uri("https://gitea.marvinelsen.com/api/packages/marvinelsen/maven")
}
}
```
Afterwards, add the package dependency to your `build.gradle.kts` file:
```kotlin
dependencies {
implementation("com.marvinelsen:cedict-parser:1.0-SNAPSHOT")
}
```
## Usage
```kotlin
fun main() {
val cedictInputStream = GZIPInputStream(object {}.javaClass.getResourceAsStream("/cedict_1_0_ts_utf-8_mdbg.txt.gz")!!)
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(";") })
}
}
```
## License
All source code in this repository is licensed under a [MIT license](LICENSE), unless otherwise noted.
To the following third-party code, data, and files in the repository different licenses apply:
### CC-CEDICT
[CC-CEDICT](https://cc-cedict.org/wiki) is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).