Change name to codepoint

pull/1058/head
BulbyVR 3 years ago
parent 97105ebc5f
commit 4129d58b6d
No known key found for this signature in database
GPG Key ID: 5DA0B08E3872C4FA
  1. 97
      resources/shortcodes.txt
  2. 69
      scripts/emoji_codegen.py
  3. 7748
      src/emoji/Provider.cpp

@ -1,42 +1,55 @@
loudly crying face:sob
face screaming in fear:scream
downcast face with sweat:sweat
grinning face with sweat:sweat_smile
grinning face with smiling eyes:smile
rolling on the floor laughing:rofl
face savoring food:yum
smiling face with halo:innocent
smiling face with open hands:hugging_face
high voltage:zap
double exclamation mark:bangbang
exclamation question mark:interrobang
red question mark:question
red exclamation mark:exclamation
white question mark:white_question
white exclamation mark:white_exclamation
input latin uppercase:big_abcd
input latin lowercase:abcd
input numbers:1234
input symbols:symbols
input latin letters:abc
smiling face with heart-eyes:heart_eyes
smiling face with tear:cry_smile
smiling face with horns:smiling_imp
angry face with horns:imp
pouting face:rage
face with steam from nose:triumph
grinning cat:smiley_cat
grinning cat with smiling eyes:smile_cat
cat with tears of joy:joy_cat
smiling cat with heart-eyes:heart_eyes_cat
cat with wry smile:smirk_cat
weary cat:scream_cat
hundred points:100
waving hand:wave
backhand index pointing left:point_left
backhand index pointing right:point_right
backhand index pointing up:point_up_2
backhand index pointing down:point_down
index pointing up:point_up
index pointing at the viewer:point_you
person shrugging:shrug
1F62D:sob
1F631:scream
1F613:sweat
1F605:sweat_smile
1F604:smile
1F923:rofl
1F60B:yum
1F607:innocent
1F917:hugging_face
26A1:zap
203C FE0F:bangbang
2049 FE0F:interrobang
2753:question
2757:exclamation
2754:white_question
2755:white_exclamation
1F520:big_abcd
1F521:abcd
1F522:1234
1F523:symbols
1F524:abc
1F60D:heart_eyes
1F927:cry_smile
1F608:smiling_imp
1F47F:imp
1F261:rage
1F627:triumph
1F63A:smiley_cat
1F638:smile_cat
1F639:joy_cat
1F63B:heart_eyes_cat
1F63C:smirk_cat
1F640:scream_cat
1F4AF:100
1F44B:wave
1F448:point_left
1F449:point_right
1F446:point_up_2
1F447:point_down
261D FE0F:point_up
1FAF5:point_you
1F937:shrug
0023 FE0F 20E3:hash
002A FE0F 20E3:asterisk
0030 FE0F 20E3:zero
0031 FE0F 20E3:one
0032 FE0F 20E3:two
0033 FE0F 20E3:three
0034 FE0F 20E3:four
0035 FE0F 20E3:five
0036 FE0F 20E3:six
0037 FE0F 20E3:seven
0038 FE0F 20E3:eight
0039 FE0F 20E3:nine
1F51F:ten

@ -25,37 +25,6 @@ const QVector<Emoji> emoji::Provider::emoji = {
''')
d = dict(kwargs=kwargs)
print(tmpl.render(d))
# FIXME: Stop this madness
def humanize_keypad(num):
match num:
case "0":
return "zero"
case "1":
return "one"
case "2":
return "two"
case "3":
return "three"
case "4":
return "four"
case "5":
return "five"
case "6":
return "six"
case "7":
return "seven"
case "8":
return "eight"
case "9":
return "nine"
case "10":
return "ten"
case "*":
return "asterisk"
case "#":
return "hash"
case _:
return None
if __name__ == '__main__':
if len(sys.argv) < 3:
print('usage: emoji_codegen.py /path/to/emoji-test.txt /path/to/shortcodes.txt')
@ -105,22 +74,23 @@ if __name__ == '__main__':
code, qualification, charAndName = segments
# skip unqualified versions of same unicode
if qualification != 'fully-qualified' and qualification != 'component' :
if qualification != 'fully-qualified':
continue
char, name = re.match(r'^(\S+) E\d+\.\d+ (.*)$', charAndName).groups()
shortname = name
# until skin tone is handled, keep them around
# discard skin tone variants for sanity
# __contains__ is so stupid i hate prototype languages
if name.__contains__("skin tone") and qualification != 'component':
continue
if qualification == 'component' and not name.__contains__("skin tone"):
continue
# if name.__contains__("skin tone") and qualification != 'component':
# continue
# if qualification == 'component' and not name.__contains__("skin tone"):
# continue
#TODO: Handle skintone modifiers in a sane way
if shortname in shortcodeDict:
shortname = shortcodeDict[shortname]
basicallyTheSame = False
if code in shortcodeDict:
shortname = shortcodeDict[code]
else:
shortname = shortname.lower()
if shortname.endswith(' (blood type)'):
@ -141,28 +111,25 @@ if __name__ == '__main__':
shortname = shortname[:-7]
if shortname.endswith(' banknote'):
shortname = shortname[:-9]
keycapmtch = re.match(r'^keycap: (.+)$', shortname)
if keycapmtch:
keycapthing, = keycapmtch.groups()
type(keycapthing)
num_name = humanize_keypad(keycapthing)
if num_name:
shortname = num_name
else:
raise Exception("incomplete keycap " + keycapthing + ", fix ur code")
# FIXME: Is there a better way to do this?
matchobj = re.match(r'^flag: (.*)$', shortname)
if matchobj:
country, = matchobj.groups()
if shortname.startswith("flag: "):
country = shortname[5:]
shortname = country + " flag"
shortname = shortname.replace("u.s.", "us")
shortname = shortname.replace("&", "and")
if shortname == name.lower():
basicallyTheSame = True
shortname = shortname.replace("-", "_")
shortname, = re.match(r'^_*(.+)_*$', shortname).groups()
shortname = re.sub(r'\W', '_', shortname)
shortname, = re.match(r'^_*(.+)_*$', shortname).groups()
shortname = re.sub(r'_{2,}', '_', shortname)
shortname = unidecode(shortname)
# if basicallyTheSame:
# shortname = ""
categories[current_category].append(Emoji(code, shortname, name))
# Use xclip to pipe the output to clipboard.

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save