Merge pull request 'Bump chinese-transliteration version' (#8) from develop into main
All checks were successful
Publish package / publish (push) Successful in 1m38s
All checks were successful
Publish package / publish (push) Successful in 1m38s
Reviewed-on: #8
This commit is contained in:
commit
7a07250542
@ -5,7 +5,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "com.marvinelsen"
|
||||
version = "2.0.0"
|
||||
version = "3.0.0"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -2,7 +2,7 @@
|
||||
kotlin = "2.0.20"
|
||||
kotest = "5.9.1"
|
||||
detekt = "1.23.7"
|
||||
chinese-transliteration = "1.0.1"
|
||||
chinese-transliteration = "2.0.0"
|
||||
|
||||
[libraries]
|
||||
chinese-transliteration = { module = "com.marvinelsen:chinese-transliteration", version.ref = "chinese-transliteration" }
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.marvinelsen.cedict.api
|
||||
|
||||
import com.marvinelsen.chinese.transliteration.Syllable
|
||||
import com.marvinelsen.chinese.transliteration.api.PinyinSyllable
|
||||
|
||||
data class CedictEntry(
|
||||
val traditional: String,
|
||||
val simplified: String,
|
||||
val pinyinSyllables: List<Syllable>,
|
||||
val pinyinSyllables: List<PinyinSyllable>,
|
||||
val definitions: List<CedictDefinition>,
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ package com.marvinelsen.cedict.internal
|
||||
import com.marvinelsen.cedict.api.CedictDefinition
|
||||
import com.marvinelsen.cedict.api.CedictEntry
|
||||
import com.marvinelsen.cedict.api.CedictParser
|
||||
import com.marvinelsen.chinese.transliteration.Syllable
|
||||
import com.marvinelsen.chinese.transliteration.api.PinyinSyllable
|
||||
import java.io.InputStream
|
||||
|
||||
internal class RegexCedictParser : CedictParser {
|
||||
@ -43,8 +43,8 @@ internal class RegexCedictParser : CedictParser {
|
||||
|
||||
private fun toPinyinSyllables(pinyinWithNumbers: String) = pinyinWithNumbers
|
||||
.split(" ")
|
||||
.filter { Syllable.isValidPinyinWithToneNumberSyllable(it) }
|
||||
.map { Syllable.fromPinyinWithToneNumber(it) }
|
||||
.filter { PinyinSyllable.isValidPinyinWithToneNumberSyllable(it) }
|
||||
.map { PinyinSyllable.fromPinyinWithToneNumber(it) }
|
||||
|
||||
private fun toCedictDefinitions(definitions: String) = definitions
|
||||
.split(DEFINITION_SEPARATOR)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.marvinelsen.cedict.internal
|
||||
|
||||
import com.marvinelsen.cedict.api.CedictDefinition
|
||||
import com.marvinelsen.chinese.transliteration.Syllable
|
||||
import com.marvinelsen.chinese.transliteration.Tone
|
||||
import com.marvinelsen.chinese.transliteration.api.PinyinSyllable
|
||||
import com.marvinelsen.chinese.transliteration.api.Tone
|
||||
import io.kotest.core.spec.style.ShouldSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import java.util.zip.GZIPInputStream
|
||||
@ -16,8 +16,8 @@ class RegexCedictParserTest : ShouldSpec({
|
||||
cedictEntry.traditional shouldBe "皮實"
|
||||
cedictEntry.simplified shouldBe "皮实"
|
||||
cedictEntry.pinyinSyllables shouldBe listOf(
|
||||
Syllable("pi", Tone.SECOND),
|
||||
Syllable("shi", Tone.FIFTH)
|
||||
PinyinSyllable("pi", Tone.SECOND),
|
||||
PinyinSyllable("shi", Tone.FIFTH)
|
||||
)
|
||||
cedictEntry.definitions shouldBe listOf(
|
||||
CedictDefinition(listOf("(of things) durable")),
|
||||
|
Loading…
Reference in New Issue
Block a user