Merge pull request 'Bump chinese-transliteration version' (#8) from develop into main
All checks were successful
Publish package / publish (push) Successful in 1m38s

Reviewed-on: #8
This commit is contained in:
Marvin Elsen 2024-10-07 19:04:18 +00:00
commit 7a07250542
5 changed files with 11 additions and 11 deletions

View File

@ -5,7 +5,7 @@ plugins {
} }
group = "com.marvinelsen" group = "com.marvinelsen"
version = "2.0.0" version = "3.0.0"
repositories { repositories {
mavenCentral() mavenCentral()

View File

@ -2,7 +2,7 @@
kotlin = "2.0.20" kotlin = "2.0.20"
kotest = "5.9.1" kotest = "5.9.1"
detekt = "1.23.7" detekt = "1.23.7"
chinese-transliteration = "1.0.1" chinese-transliteration = "2.0.0"
[libraries] [libraries]
chinese-transliteration = { module = "com.marvinelsen:chinese-transliteration", version.ref = "chinese-transliteration" } chinese-transliteration = { module = "com.marvinelsen:chinese-transliteration", version.ref = "chinese-transliteration" }

View File

@ -1,10 +1,10 @@
package com.marvinelsen.cedict.api package com.marvinelsen.cedict.api
import com.marvinelsen.chinese.transliteration.Syllable import com.marvinelsen.chinese.transliteration.api.PinyinSyllable
data class CedictEntry( data class CedictEntry(
val traditional: String, val traditional: String,
val simplified: String, val simplified: String,
val pinyinSyllables: List<Syllable>, val pinyinSyllables: List<PinyinSyllable>,
val definitions: List<CedictDefinition>, val definitions: List<CedictDefinition>,
) )

View File

@ -3,7 +3,7 @@ package com.marvinelsen.cedict.internal
import com.marvinelsen.cedict.api.CedictDefinition import com.marvinelsen.cedict.api.CedictDefinition
import com.marvinelsen.cedict.api.CedictEntry import com.marvinelsen.cedict.api.CedictEntry
import com.marvinelsen.cedict.api.CedictParser import com.marvinelsen.cedict.api.CedictParser
import com.marvinelsen.chinese.transliteration.Syllable import com.marvinelsen.chinese.transliteration.api.PinyinSyllable
import java.io.InputStream import java.io.InputStream
internal class RegexCedictParser : CedictParser { internal class RegexCedictParser : CedictParser {
@ -43,8 +43,8 @@ internal class RegexCedictParser : CedictParser {
private fun toPinyinSyllables(pinyinWithNumbers: String) = pinyinWithNumbers private fun toPinyinSyllables(pinyinWithNumbers: String) = pinyinWithNumbers
.split(" ") .split(" ")
.filter { Syllable.isValidPinyinWithToneNumberSyllable(it) } .filter { PinyinSyllable.isValidPinyinWithToneNumberSyllable(it) }
.map { Syllable.fromPinyinWithToneNumber(it) } .map { PinyinSyllable.fromPinyinWithToneNumber(it) }
private fun toCedictDefinitions(definitions: String) = definitions private fun toCedictDefinitions(definitions: String) = definitions
.split(DEFINITION_SEPARATOR) .split(DEFINITION_SEPARATOR)

View File

@ -1,8 +1,8 @@
package com.marvinelsen.cedict.internal package com.marvinelsen.cedict.internal
import com.marvinelsen.cedict.api.CedictDefinition import com.marvinelsen.cedict.api.CedictDefinition
import com.marvinelsen.chinese.transliteration.Syllable import com.marvinelsen.chinese.transliteration.api.PinyinSyllable
import com.marvinelsen.chinese.transliteration.Tone import com.marvinelsen.chinese.transliteration.api.Tone
import io.kotest.core.spec.style.ShouldSpec import io.kotest.core.spec.style.ShouldSpec
import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldBe
import java.util.zip.GZIPInputStream import java.util.zip.GZIPInputStream
@ -16,8 +16,8 @@ class RegexCedictParserTest : ShouldSpec({
cedictEntry.traditional shouldBe "皮實" cedictEntry.traditional shouldBe "皮實"
cedictEntry.simplified shouldBe "皮实" cedictEntry.simplified shouldBe "皮实"
cedictEntry.pinyinSyllables shouldBe listOf( cedictEntry.pinyinSyllables shouldBe listOf(
Syllable("pi", Tone.SECOND), PinyinSyllable("pi", Tone.SECOND),
Syllable("shi", Tone.FIFTH) PinyinSyllable("shi", Tone.FIFTH)
) )
cedictEntry.definitions shouldBe listOf( cedictEntry.definitions shouldBe listOf(
CedictDefinition(listOf("(of things) durable")), CedictDefinition(listOf("(of things) durable")),