fix emoji_map.txt
This commit is contained in:
parent
802bff017c
commit
52aa1ee126
|
@ -217,14 +217,18 @@ class App {
|
|||
|
||||
val hrefList = ArrayList<Pair<String, CodepointList>>()
|
||||
|
||||
for( cols in root.jsonArray("qualifiedCode")!!.filterIsInstance<JsonArray>()){
|
||||
var countError = 0
|
||||
|
||||
for( cols in root.jsonArray("qualifiedCode")!!.filterIsInstance<JsonArray>()) {
|
||||
val spanText = cols[0] as String
|
||||
var href = cols[1] as String
|
||||
|
||||
val code = spanText.listCodePoints().toCodepointList(cameFrom)
|
||||
var code = spanText.listCodePoints().toCodepointList(cameFrom)
|
||||
?: error("can't get code from $spanText $href")
|
||||
|
||||
if( hrefList.any{ it.first == href})
|
||||
|
||||
|
||||
if (hrefList.any { it.first == href })
|
||||
error("duplicate href: $href")
|
||||
|
||||
hrefList.add(Pair(href, code))
|
||||
|
@ -244,7 +248,14 @@ class App {
|
|||
val key = code.toKey(cameFrom)
|
||||
?: error("can't get key from ${code.toHex()} ${shortName.name}")
|
||||
|
||||
fixUnified[key] = code
|
||||
if (!fixUnified.containsKey(key)) {
|
||||
if (code.list.size == 1 && code.list.first() < 256) {
|
||||
++countError
|
||||
log.e("bad unified code: $code")
|
||||
} else {
|
||||
fixUnified[key] = code
|
||||
}
|
||||
}
|
||||
|
||||
if (ignoreShortName.any { it == shortName.name }) {
|
||||
log.w("skip shortname $shortName $code")
|
||||
|
@ -255,6 +266,8 @@ class App {
|
|||
}
|
||||
|
||||
// hrefList.sortedBy{ it.first }.forEach { log.d("href=${it.first} ${it.second}") }
|
||||
|
||||
if(countError>0) error("please fix unified codes. countError=$countError")
|
||||
}
|
||||
|
||||
private fun addEmojipediaShortnames() {
|
||||
|
@ -299,6 +312,7 @@ class App {
|
|||
val reCodeSpec = codeSpec.toRegex()
|
||||
var countFound = 0
|
||||
var countCreate = 0
|
||||
var countError = 0
|
||||
for( imageFile in dir.listFiles()!!){
|
||||
if (!imageFile.isFile) continue
|
||||
val unixPath = imageFile.path.replace("\\", "/")
|
||||
|
@ -318,8 +332,13 @@ class App {
|
|||
|
||||
var emoji = emojiMap[key]
|
||||
if (emoji == null) {
|
||||
val unified2 = fixUnified[key]
|
||||
emoji = Emoji(key, unified2 ?: unifiedQualifier(code))
|
||||
val unified2 = fixUnified[key] ?: unifiedQualifier(code)
|
||||
if( unified2.list.size==1 && unified2.list.first()<256){
|
||||
++countError
|
||||
log.e("bad unified code: $unified2")
|
||||
}
|
||||
emoji = Emoji(key, unified2)
|
||||
|
||||
emojiMap[key] = emoji
|
||||
++countCreate
|
||||
}
|
||||
|
@ -327,7 +346,9 @@ class App {
|
|||
emoji.imageFiles.add(Pair(imageFile, cameFrom))
|
||||
emoji.addCode(code)
|
||||
}
|
||||
|
||||
log.d("scanImageDir: found=$countFound,create=$countCreate, dir=$dir")
|
||||
if(countError>0) error("please fix unified codes. countError=$countError")
|
||||
}
|
||||
|
||||
// サブフォルダをスキャンして絵文字別に画像データを確定する
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -41,7 +41,7 @@ object EmojiMap {
|
|||
fun addCode(emoji: UnicodeEmoji, code: String) {
|
||||
if (isIgnored(code)) return
|
||||
unicodeMap[code] = emoji
|
||||
unicodeTrie.append(code,0,emoji)
|
||||
unicodeTrie.append(code, 0, emoji)
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,13 +112,17 @@ object EmojiMap {
|
|||
val category = lastCategory
|
||||
?: error("missing lastCategory.")
|
||||
val emoji = unicodeMap[line] ?: error("missing emoji.")
|
||||
if (!category.emoji_list.contains(emoji))
|
||||
// if (emoji == null) {
|
||||
// Log.w("SubwayTooter", "missing emoji. lno=$lno line=$rawLine")
|
||||
// } else
|
||||
if (!category.emoji_list.contains(emoji)) {
|
||||
category.emoji_list.add(emoji)
|
||||
}
|
||||
}
|
||||
else -> error("unknown header $head")
|
||||
}
|
||||
} catch (ex: Throwable) {
|
||||
Log.e("SubwayTooter","EmojiMap load error.",ex)
|
||||
Log.e("SubwayTooter", "EmojiMap load error.", ex)
|
||||
error("EmojiMap load error: ${ex.javaClass.simpleName} ${ex.message} lno=$lno line=$rawLine")
|
||||
}
|
||||
}
|
||||
|
@ -156,9 +160,9 @@ object EmojiMap {
|
|||
readStream(appContext, it)
|
||||
}
|
||||
shortNameList.sort()
|
||||
for( emoji in unicodeMap.values){
|
||||
if( emoji.unifiedCode.isEmpty()) error("missing unifiedCode. ${emoji.assetsName ?: emoji.drawableId.toString()}")
|
||||
if( emoji.unifiedName.isEmpty()) error("missing unifiedName. ${emoji.assetsName ?: emoji.drawableId.toString()}")
|
||||
for (emoji in unicodeMap.values) {
|
||||
if (emoji.unifiedCode.isEmpty()) error("missing unifiedCode. ${emoji.assetsName ?: emoji.drawableId.toString()}")
|
||||
if (emoji.unifiedName.isEmpty()) error("missing unifiedName. ${emoji.assetsName ?: emoji.drawableId.toString()}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue