Fix mismatching (searchable) pinyin with numbers for vowels u:, v and ü
This commit is contained in:
parent
5202765a09
commit
816bdd8f51
@ -78,7 +78,7 @@ fun main() {
|
|||||||
4,
|
4,
|
||||||
entry.pinyinSyllables.joinToString(
|
entry.pinyinSyllables.joinToString(
|
||||||
separator = " "
|
separator = " "
|
||||||
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) }
|
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS).replace("u:", "ü").replace("v", "ü") }
|
||||||
)
|
)
|
||||||
insertStatement.setString(
|
insertStatement.setString(
|
||||||
5,
|
5,
|
||||||
@ -163,7 +163,7 @@ private fun createCrossStraitsEntries(connection: Connection) {
|
|||||||
"SELECT id FROM entry WHERE traditional = '${entry.traditional}' AND pinyin_with_tone_numbers = '${
|
"SELECT id FROM entry WHERE traditional = '${entry.traditional}' AND pinyin_with_tone_numbers = '${
|
||||||
pronunciation.joinToString(
|
pronunciation.joinToString(
|
||||||
separator = " "
|
separator = " "
|
||||||
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) }
|
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS).replace("u:", "ü").replace("v", "ü") }
|
||||||
}'"
|
}'"
|
||||||
)
|
)
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
@ -187,7 +187,7 @@ private fun createCrossStraitsEntries(connection: Connection) {
|
|||||||
4,
|
4,
|
||||||
pronunciation.joinToString(
|
pronunciation.joinToString(
|
||||||
separator = " "
|
separator = " "
|
||||||
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) }
|
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS).replace("u:", "ü").replace("v", "ü") }
|
||||||
)
|
)
|
||||||
insertStatement.setString(
|
insertStatement.setString(
|
||||||
5,
|
5,
|
||||||
@ -270,7 +270,10 @@ private fun createMoedictEntries(connection: Connection) {
|
|||||||
"SELECT id FROM entry WHERE traditional = '$traditional' AND pinyin_with_tone_numbers = '${
|
"SELECT id FROM entry WHERE traditional = '$traditional' AND pinyin_with_tone_numbers = '${
|
||||||
pronunciation.joinToString(
|
pronunciation.joinToString(
|
||||||
separator = " "
|
separator = " "
|
||||||
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) }
|
) { it.format(
|
||||||
|
TransliterationSystem.PINYIN_WITH_TONE_NUMBERS
|
||||||
|
).replace("u:", "ü").replace("v", "ü")
|
||||||
|
}
|
||||||
}'"
|
}'"
|
||||||
)
|
)
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
@ -294,7 +297,11 @@ private fun createMoedictEntries(connection: Connection) {
|
|||||||
4,
|
4,
|
||||||
pronunciation.joinToString(
|
pronunciation.joinToString(
|
||||||
separator = " "
|
separator = " "
|
||||||
) { it.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS) }
|
) {
|
||||||
|
it.format(
|
||||||
|
TransliterationSystem.PINYIN_WITH_TONE_NUMBERS
|
||||||
|
).replace("u:", "ü").replace("v", "ü")
|
||||||
|
}
|
||||||
)
|
)
|
||||||
insertStatement.setString(
|
insertStatement.setString(
|
||||||
5,
|
5,
|
||||||
@ -371,7 +378,7 @@ private fun String.sanitizeMoeTitle() = this
|
|||||||
.replace("""\(.*\)""".toRegex(), "")
|
.replace("""\(.*\)""".toRegex(), "")
|
||||||
|
|
||||||
private fun PinyinSyllable.toSearchablePinyinWithToneNumbers() =
|
private fun PinyinSyllable.toSearchablePinyinWithToneNumbers() =
|
||||||
this.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS).lowercase()
|
this.format(TransliterationSystem.PINYIN_WITH_TONE_NUMBERS).lowercase().replace("u:", "v").replace("ü", "v")
|
||||||
|
|
||||||
private fun PinyinSyllable.toSearchablePinyin() =
|
private fun PinyinSyllable.toSearchablePinyin() =
|
||||||
this.toSearchablePinyinWithToneNumbers().replace("""\d""".toRegex(), "")
|
this.toSearchablePinyinWithToneNumbers().replace("""\d""".toRegex(), "")
|
||||||
|
Loading…
Reference in New Issue
Block a user