Unexpected-Keyboard/emoji_gen.py
Jules Aguillon 77e0efd3de Remove duplicate emojis and skin tones
Statuses other than "fully-qualified" are duplicates or won't render.
Skin tones are available using combinations, no need to keep each
variants.
2021-01-17 00:20:09 +01:00

909 lines
22 KiB
Python

from enum import Enum
import sys
class Line(Enum):
IGNORE = 0
GROUP = 1
ENTRY = 2
def parse_line(line):
if line.startswith("# group:"):
return (Line.GROUP, line.split(":")[1].strip())
else:
lr = line.split("#", 1)
if lr[0] == "" or len(lr) != 2:
return (Line.IGNORE, line)
else:
code, status = lr[0].split(";", 1)
desc = lr[1].strip().split(" ", 2)[2]
return (Line.ENTRY, (code.strip(), status.strip(), desc))
def parse_lines(inp):
entries = {}
group = "none"
for line in inp:
tok, k = parse_line(line)
if tok == Line.GROUP:
group = k
elif tok == Line.ENTRY:
entries.setdefault(group, []).append(k)
return entries
name_map = {
"1F44D": ":+1:",
"1F44E": ":-1:",
"1F4AF": ":100:",
"1F522": ":1234:",
"1F3B1": ":8ball:",
"1F170": ":a:",
"1F18E": ":ab:",
"1F524": ":abc:",
"1F521": ":abcd:",
"1F251": ":accept:",
"1F6A1": ":aerial_tramway:",
"02708": ":airplane:",
"023F0": ":alarm_clock:",
"1F47D": ":alien:",
"1F691": ":ambulance:",
"02693": ":anchor:",
"1F47C": ":angel:",
"1F4A2": ":anger:",
"1F620": ":angry:",
"1F627": ":anguished:",
"1F41C": ":ant:",
"1F34E": ":apple:",
"02652": ":aquarius:",
"02648": ":aries:",
"025C0": ":arrow_backward:",
"023EC": ":arrow_double_down:",
"023EB": ":arrow_double_up:",
"02B07": ":arrow_down:",
"1F53D": ":arrow_down_small:",
"025B6": ":arrow_forward:",
"02935": ":arrow_heading_down:",
"02934": ":arrow_heading_up:",
"02B05": ":arrow_left:",
"02199": ":arrow_lower_left:",
"02198": ":arrow_lower_right:",
"027A1": ":arrow_right:",
"021AA": ":arrow_right_hook:",
"02B06": ":arrow_up:",
"02195": ":arrow_up_down:",
"1F53C": ":arrow_up_small:",
"02196": ":arrow_upper_left:",
"02197": ":arrow_upper_right:",
"1F503": ":arrows_clockwise:",
"1F504": ":arrows_counterclockwise:",
"1F3A8": ":art:",
"1F69B": ":articulated_lorry:",
"1F632": ":astonished:",
"1F45F": ":athletic_shoe:",
"1F3E7": ":atm:",
"1F171": ":b:",
"1F476": ":baby:",
"1F37C": ":baby_bottle:",
"1F424": ":baby_chick:",
"1F6BC": ":baby_symbol:",
"1F519": ":back:",
"1F6C4": ":baggage_claim:",
"1F388": ":balloon:",
"02611": ":ballot_box_with_check:",
"1F38D": ":bamboo:",
"1F34C": ":banana:",
"0203C": ":bangbang:",
"1F3E6": ":bank:",
"1F4CA": ":bar_chart:",
"1F488": ":barber:",
"026BE": ":baseball:",
"1F3C0": ":basketball:",
"1F6C0": ":bath:",
"1F6C1": ":bathtub:",
"1F50B": ":battery:",
"1F43B": ":bear:",
"1F41D": ":bee:",
"1F37A": ":beer:",
"1F37B": ":beers:",
"1F41E": ":beetle:",
"1F530": ":beginner:",
"1F514": ":bell:",
"1F371": ":bento:",
"1F6B4": ":bicyclist:",
"1F6B2": ":bike:",
"1F459": ":bikini:",
"1F426": ":bird:",
"1F382": ":birthday:",
"026AB": ":black_circle:",
"1F0CF": ":black_joker:",
"02B1B": ":black_large_square:",
"025FE": ":black_medium_small_square:",
"025FC": ":black_medium_square:",
"02712": ":black_nib:",
"025AA": ":black_small_square:",
"1F532": ":black_square_button:",
"1F33C": ":blossom:",
"1F421": ":blowfish:",
"1F4D8": ":blue_book:",
"1F699": ":blue_car:",
"1F499": ":blue_heart:",
"1F60A": ":blush:",
"1F417": ":boar:",
"026F5": ":boat:",
"1F4A3": ":bomb:",
"1F4D6": ":book:",
"1F516": ":bookmark:",
"1F4D1": ":bookmark_tabs:",
"1F4DA": ":books:",
"1F4A5": ":boom:",
"1F462": ":boot:",
"1F490": ":bouquet:",
"1F647": ":bow:",
"1F3B3": ":bowling:",
"1F466": ":boy:",
"1F35E": ":bread:",
"1F470": ":bride_with_veil:",
"1F309": ":bridge_at_night:",
"1F4BC": ":briefcase:",
"1F494": ":broken_heart:",
"1F41B": ":bug:",
"1F4A1": ":bulb:",
"1F685": ":bullettrain_front:",
"1F684": ":bullettrain_side:",
"1F68C": ":bus:",
"1F68F": ":busstop:",
"1F464": ":bust_in_silhouette:",
"1F465": ":busts_in_silhouette:",
"1F335": ":cactus:",
"1F370": ":cake:",
"1F4C6": ":calendar:",
"1F4F2": ":calling:",
"1F42B": ":camel:",
"1F4F7": ":camera:",
"0264B": ":cancer:",
"1F36C": ":candy:",
"1F520": ":capital_abcd:",
"02651": ":capricorn:",
"1F697": ":car:",
"1F4C7": ":card_index:",
"1F3A0": ":carousel_horse:",
"1F431": ":cat:",
"1F408": ":cat2:",
"1F4BF": ":cd:",
"1F4B9": ":chart:",
"1F4C9": ":chart_with_downwards_trend:",
"1F4C8": ":chart_with_upwards_trend:",
"1F3C1": ":checkered_flag:",
"1F352": ":cherries:",
"1F338": ":cherry_blossom:",
"1F330": ":chestnut:",
"1F414": ":chicken:",
"1F6B8": ":children_crossing:",
"1F36B": ":chocolate_bar:",
"1F384": ":christmas_tree:",
"026EA": ":church:",
"1F3A6": ":cinema:",
"1F3AA": ":circus_tent:",
"1F307": ":city_sunrise:",
"1F306": ":city_sunset:",
"1F191": ":cl:",
"1F44F": ":clap:",
"1F3AC": ":clapper:",
"1F4CB": ":clipboard:",
"1F550": ":clock1:",
"1F559": ":clock10:",
"1F565": ":clock1030:",
"1F55A": ":clock11:",
"1F566": ":clock1130:",
"1F55B": ":clock12:",
"1F567": ":clock1230:",
"1F55C": ":clock130:",
"1F551": ":clock2:",
"1F55D": ":clock230:",
"1F552": ":clock3:",
"1F55E": ":clock330:",
"1F553": ":clock4:",
"1F55F": ":clock430:",
"1F554": ":clock5:",
"1F560": ":clock530:",
"1F555": ":clock6:",
"1F561": ":clock630:",
"1F556": ":clock7:",
"1F562": ":clock730:",
"1F557": ":clock8:",
"1F563": ":clock830:",
"1F558": ":clock9:",
"1F564": ":clock930:",
"1F4D5": ":closed_book:",
"1F510": ":closed_lock_with_key:",
"1F302": ":closed_umbrella:",
"02601": ":cloud:",
"02663": ":clubs:",
"1F378": ":cocktail:",
"02615": ":coffee:",
"1F630": ":cold_sweat:",
"1F4A5": ":collision:",
"1F4BB": ":computer:",
"1F38A": ":confetti_ball:",
"1F616": ":confounded:",
"1F615": ":confused:",
"03297": ":congratulations:",
"1F6A7": ":construction:",
"1F477": ":construction_worker:",
"1F3EA": ":convenience_store:",
"1F36A": ":cookie:",
"1F192": ":cool:",
"1F46E": ":cop:",
"000A9": ":copyright:",
"1F33D": ":corn:",
"1F46B": ":couple:",
"1F491": ":couple_with_heart:",
"1F48F": ":couplekiss:",
"1F42E": ":cow:",
"1F404": ":cow2:",
"1F4B3": ":credit_card:",
"1F319": ":crescent_moon:",
"1F40A": ":crocodile:",
"1F38C": ":crossed_flags:",
"1F451": ":crown:",
"1F622": ":cry:",
"1F63F": ":crying_cat_face:",
"1F52E": ":crystal_ball:",
"1F498": ":cupid:",
"027B0": ":curly_loop:",
"1F4B1": ":currency_exchange:",
"1F35B": ":curry:",
"1F36E": ":custard:",
"1F6C3": ":customs:",
"1F300": ":cyclone:",
"1F483": ":dancer:",
"1F46F": ":dancers:",
"1F361": ":dango:",
"1F3AF": ":dart:",
"1F4A8": ":dash:",
"1F4C5": ":date:",
"1F333": ":deciduous_tree:",
"1F3EC": ":department_store:",
"1F4A0": ":diamond_shape_with_a_dot_inside:",
"02666": ":diamonds:",
"1F61E": ":disappointed:",
"1F625": ":disappointed_relieved:",
"1F4AB": ":dizzy:",
"1F635": ":dizzy_face:",
"1F6AF": ":do_not_litter:",
"1F436": ":dog:",
"1F415": ":dog2:",
"1F4B5": ":dollar:",
"1F38E": ":dolls:",
"1F42C": ":dolphin:",
"1F6AA": ":door:",
"1F369": ":doughnut:",
"1F409": ":dragon:",
"1F432": ":dragon_face:",
"1F457": ":dress:",
"1F42A": ":dromedary_camel:",
"1F4A7": ":droplet:",
"1F4C0": ":dvd:",
"1F4E7": ":e-mail:",
"1F442": ":ear:",
"1F33E": ":ear_of_rice:",
"1F30D": ":earth_africa:",
"1F30E": ":earth_americas:",
"1F30F": ":earth_asia:",
"1F373": ":egg:",
"1F346": ":eggplant:",
"02734": ":eight_pointed_black_star:",
"02733": ":eight_spoked_asterisk:",
"1F50C": ":electric_plug:",
"1F418": ":elephant:",
"02709": ":email:",
"1F51A": ":end:",
"02709": ":envelope:",
"1F4E9": ":envelope_with_arrow:",
"1F4B6": ":euro:",
"1F3F0": ":european_castle:",
"1F3E4": ":european_post_office:",
"1F332": ":evergreen_tree:",
"02757": ":exclamation:",
"1F611": ":expressionless:",
"1F453": ":eyeglasses:",
"1F440": ":eyes:",
"1F44A": ":facepunch:",
"1F3ED": ":factory:",
"1F342": ":fallen_leaf:",
"1F46A": ":family:",
"023E9": ":fast_forward:",
"1F4E0": ":fax:",
"1F628": ":fearful:",
"1F43E": ":feet:",
"1F3A1": ":ferris_wheel:",
"1F4C1": ":file_folder:",
"1F525": ":fire:",
"1F692": ":fire_engine:",
"1F386": ":fireworks:",
"1F313": ":first_quarter_moon:",
"1F31B": ":first_quarter_moon_with_face:",
"1F41F": ":fish:",
"1F365": ":fish_cake:",
"1F3A3": ":fishing_pole_and_fish:",
"0270A": ":fist:",
"1F38F": ":flags:",
"1F526": ":flashlight:",
"1F42C": ":flipper:",
"1F4BE": ":floppy_disk:",
"1F3B4": ":flower_playing_cards:",
"1F633": ":flushed:",
"1F301": ":foggy:",
"1F3C8": ":football:",
"1F463": ":footprints:",
"1F374": ":fork_and_knife:",
"026F2": ":fountain:",
"1F340": ":four_leaf_clover:",
"1F193": ":free:",
"1F364": ":fried_shrimp:",
"1F35F": ":fries:",
"1F438": ":frog:",
"1F626": ":frowning:",
"026FD": ":fuelpump:",
"1F315": ":full_moon:",
"1F31D": ":full_moon_with_face:",
"1F3B2": ":game_die:",
"1F48E": ":gem:",
"0264A": ":gemini:",
"1F47B": ":ghost:",
"1F381": ":gift:",
"1F49D": ":gift_heart:",
"1F467": ":girl:",
"1F310": ":globe_with_meridians:",
"1F410": ":goat:",
"026F3": ":golf:",
"1F347": ":grapes:",
"1F34F": ":green_apple:",
"1F4D7": ":green_book:",
"1F49A": ":green_heart:",
"02755": ":grey_exclamation:",
"02754": ":grey_question:",
"1F62C": ":grimacing:",
"1F601": ":grin:",
"1F600": ":grinning:",
"1F482": ":guardsman:",
"1F3B8": ":guitar:",
"1F52B": ":gun:",
"1F487": ":haircut:",
"1F354": ":hamburger:",
"1F528": ":hammer:",
"1F439": ":hamster:",
"0270B": ":hand:",
"1F45C": ":handbag:",
"1F4A9": ":hankey:",
"1F425": ":hatched_chick:",
"1F423": ":hatching_chick:",
"1F3A7": ":headphones:",
"1F649": ":hear_no_evil:",
"02764": ":heart:",
"1F49F": ":heart_decoration:",
"1F60D": ":heart_eyes:",
"1F63B": ":heart_eyes_cat:",
"1F493": ":heartbeat:",
"1F497": ":heartpulse:",
"02665": ":hearts:",
"02714": ":heavy_check_mark:",
"02797": ":heavy_division_sign:",
"1F4B2": ":heavy_dollar_sign:",
"02757": ":heavy_exclamation_mark:",
"02796": ":heavy_minus_sign:",
"02716": ":heavy_multiplication_x:",
"02795": ":heavy_plus_sign:",
"1F681": ":helicopter:",
"1F33F": ":herb:",
"1F33A": ":hibiscus:",
"1F506": ":high_brightness:",
"1F460": ":high_heel:",
"1F52A": ":hocho:",
"1F36F": ":honey_pot:",
"1F41D": ":honeybee:",
"1F434": ":horse:",
"1F3C7": ":horse_racing:",
"1F3E5": ":hospital:",
"1F3E8": ":hotel:",
"02668": ":hotsprings:",
"0231B": ":hourglass:",
"023F3": ":hourglass_flowing_sand:",
"1F3E0": ":house:",
"1F3E1": ":house_with_garden:",
"1F62F": ":hushed:",
"1F368": ":ice_cream:",
"1F366": ":icecream:",
"1F194": ":id:",
"1F250": ":ideograph_advantage:",
"1F47F": ":imp:",
"1F4E5": ":inbox_tray:",
"1F4E8": ":incoming_envelope:",
"1F481": ":information_desk_person:",
"02139": ":information_source:",
"1F607": ":innocent:",
"02049": ":interrobang:",
"1F4F1": ":iphone:",
"1F3EE": ":izakaya_lantern:",
"1F383": ":jack_o_lantern:",
"1F5FE": ":japan:",
"1F3EF": ":japanese_castle:",
"1F47A": ":japanese_goblin:",
"1F479": ":japanese_ogre:",
"1F456": ":jeans:",
"1F602": ":joy:",
"1F639": ":joy_cat:",
"1F511": ":key:",
"1F51F": ":keycap_ten:",
"1F458": ":kimono:",
"1F48B": ":kiss:",
"1F617": ":kissing:",
"1F63D": ":kissing_cat:",
"1F61A": ":kissing_closed_eyes:",
"1F618": ":kissing_heart:",
"1F619": ":kissing_smiling_eyes:",
"1F428": ":koala:",
"1F201": ":koko:",
"1F3EE": ":lantern:",
"1F535": ":large_blue_circle:",
"1F537": ":large_blue_diamond:",
"1F536": ":large_orange_diamond:",
"1F317": ":last_quarter_moon:",
"1F31C": ":last_quarter_moon_with_face:",
"1F606": ":laughing:",
"1F343": ":leaves:",
"1F4D2": ":ledger:",
"1F6C5": ":left_luggage:",
"02194": ":left_right_arrow:",
"021A9": ":leftwards_arrow_with_hook:",
"1F34B": ":lemon:",
"0264C": ":leo:",
"1F406": ":leopard:",
"0264E": ":libra:",
"1F688": ":light_rail:",
"1F517": ":link:",
"1F444": ":lips:",
"1F484": ":lipstick:",
"1F512": ":lock:",
"1F50F": ":lock_with_ink_pen:",
"1F36D": ":lollipop:",
"027BF": ":loop:",
"1F4E2": ":loudspeaker:",
"1F3E9": ":love_hotel:",
"1F48C": ":love_letter:",
"1F505": ":low_brightness:",
"024C2": ":m:",
"1F50D": ":mag:",
"1F50E": ":mag_right:",
"1F004": ":mahjong:",
"1F4EB": ":mailbox:",
"1F4EA": ":mailbox_closed:",
"1F4EC": ":mailbox_with_mail:",
"1F4ED": ":mailbox_with_no_mail:",
"1F468": ":man:",
"1F472": ":man_with_gua_pi_mao:",
"1F473": ":man_with_turban:",
"1F45E": ":mans_shoe:",
"1F341": ":maple_leaf:",
"1F637": ":mask:",
"1F486": ":massage:",
"1F356": ":meat_on_bone:",
"1F4E3": ":mega:",
"1F348": ":melon:",
"1F4DD": ":memo:",
"1F6B9": ":mens:",
"1F687": ":metro:",
"1F3A4": ":microphone:",
"1F52C": ":microscope:",
"1F30C": ":milky_way:",
"1F690": ":minibus:",
"1F4BD": ":minidisc:",
"1F4F4": ":mobile_phone_off:",
"1F4B8": ":money_with_wings:",
"1F4B0": ":moneybag:",
"1F412": ":monkey:",
"1F435": ":monkey_face:",
"1F69D": ":monorail:",
"1F314": ":moon:",
"1F393": ":mortar_board:",
"1F5FB": ":mount_fuji:",
"1F6B5": ":mountain_bicyclist:",
"1F6A0": ":mountain_cableway:",
"1F69E": ":mountain_railway:",
"1F42D": ":mouse:",
"1F401": ":mouse2:",
"1F3A5": ":movie_camera:",
"1F5FF": ":moyai:",
"1F4AA": ":muscle:",
"1F344": ":mushroom:",
"1F3B9": ":musical_keyboard:",
"1F3B5": ":musical_note:",
"1F3BC": ":musical_score:",
"1F507": ":mute:",
"1F485": ":nail_care:",
"1F4DB": ":name_badge:",
"1F454": ":necktie:",
"0274E": ":negative_squared_cross_mark:",
"1F610": ":neutral_face:",
"1F195": ":new:",
"1F311": ":new_moon:",
"1F31A": ":new_moon_with_face:",
"1F4F0": ":newspaper:",
"1F196": ":ng:",
"1F515": ":no_bell:",
"1F6B3": ":no_bicycles:",
"026D4": ":no_entry:",
"1F6AB": ":no_entry_sign:",
"1F645": ":no_good:",
"1F4F5": ":no_mobile_phones:",
"1F636": ":no_mouth:",
"1F6B7": ":no_pedestrians:",
"1F6AD": ":no_smoking:",
"1F6B1": ":non-potable_water:",
"1F443": ":nose:",
"1F4D3": ":notebook:",
"1F4D4": ":notebook_with_decorative_cover:",
"1F3B6": ":notes:",
"1F529": ":nut_and_bolt:",
"02B55": ":o:",
"1F17E": ":o2:",
"1F30A": ":ocean:",
"1F419": ":octopus:",
"1F362": ":oden:",
"1F3E2": ":office:",
"1F197": ":ok:",
"1F44C": ":ok_hand:",
"1F646": ":ok_woman:",
"1F474": ":older_man:",
"1F475": ":older_woman:",
"1F51B": ":on:",
"1F698": ":oncoming_automobile:",
"1F68D": ":oncoming_bus:",
"1F694": ":oncoming_police_car:",
"1F696": ":oncoming_taxi:",
"1F4D6": ":open_book:",
"1F4C2": ":open_file_folder:",
"1F450": ":open_hands:",
"1F62E": ":open_mouth:",
"026CE": ":ophiuchus:",
"1F4D9": ":orange_book:",
"1F4E4": ":outbox_tray:",
"1F402": ":ox:",
"1F4E6": ":package:",
"1F4C4": ":page_facing_up:",
"1F4C3": ":page_with_curl:",
"1F4DF": ":pager:",
"1F334": ":palm_tree:",
"1F43C": ":panda_face:",
"1F4CE": ":paperclip:",
"1F17F": ":parking:",
"0303D": ":part_alternation_mark:",
"026C5": ":partly_sunny:",
"1F6C2": ":passport_control:",
"1F43E": ":paw_prints:",
"1F351": ":peach:",
"1F350": ":pear:",
"1F4DD": ":pencil:",
"0270F": ":pencil2:",
"1F427": ":penguin:",
"1F614": ":pensive:",
"1F3AD": ":performing_arts:",
"1F623": ":persevere:",
"1F64D": ":person_frowning:",
"1F471": ":person_with_blond_hair:",
"1F64E": ":person_with_pouting_face:",
"0260E": ":phone:",
"1F437": ":pig:",
"1F416": ":pig2:",
"1F43D": ":pig_nose:",
"1F48A": ":pill:",
"1F34D": ":pineapple:",
"02653": ":pisces:",
"1F355": ":pizza:",
"1F447": ":point_down:",
"1F448": ":point_left:",
"1F449": ":point_right:",
"0261D": ":point_up:",
"1F446": ":point_up_2:",
"1F693": ":police_car:",
"1F429": ":poodle:",
"1F4A9": ":poop:",
"1F3E3": ":post_office:",
"1F4EF": ":postal_horn:",
"1F4EE": ":postbox:",
"1F6B0": ":potable_water:",
"1F45D": ":pouch:",
"1F357": ":poultry_leg:",
"1F4B7": ":pound:",
"1F63E": ":pouting_cat:",
"1F64F": ":pray:",
"1F478": ":princess:",
"1F44A": ":punch:",
"1F49C": ":purple_heart:",
"1F45B": ":purse:",
"1F4CC": ":pushpin:",
"1F6AE": ":put_litter_in_its_place:",
"02753": ":question:",
"1F430": ":rabbit:",
"1F407": ":rabbit2:",
"1F40E": ":racehorse:",
"1F4FB": ":radio:",
"1F518": ":radio_button:",
"1F621": ":rage:",
"1F683": ":railway_car:",
"1F308": ":rainbow:",
"0270B": ":raised_hand:",
"1F64C": ":raised_hands:",
"1F64B": ":raising_hand:",
"1F40F": ":ram:",
"1F35C": ":ramen:",
"1F400": ":rat:",
"0267B": ":recycle:",
"1F697": ":red_car:",
"1F534": ":red_circle:",
"000AE": ":registered:",
"0263A": ":relaxed:",
"1F60C": ":relieved:",
"1F501": ":repeat:",
"1F502": ":repeat_one:",
"1F6BB": ":restroom:",
"1F49E": ":revolving_hearts:",
"023EA": ":rewind:",
"1F380": ":ribbon:",
"1F35A": ":rice:",
"1F359": ":rice_ball:",
"1F358": ":rice_cracker:",
"1F391": ":rice_scene:",
"1F48D": ":ring:",
"1F680": ":rocket:",
"1F3A2": ":roller_coaster:",
"1F413": ":rooster:",
"1F339": ":rose:",
"1F6A8": ":rotating_light:",
"1F4CD": ":round_pushpin:",
"1F6A3": ":rowboat:",
"1F3C9": ":rugby_football:",
"1F3C3": ":runner:",
"1F3C3": ":running:",
"1F3BD": ":running_shirt_with_sash:",
"1F202": ":sa:",
"02650": ":sagittarius:",
"026F5": ":sailboat:",
"1F376": ":sake:",
"1F461": ":sandal:",
"1F385": ":santa:",
"1F4E1": ":satellite:",
"1F606": ":satisfied:",
"1F3B7": ":saxophone:",
"1F3EB": ":school:",
"1F392": ":school_satchel:",
"02702": ":scissors:",
"0264F": ":scorpius:",
"1F631": ":scream:",
"1F640": ":scream_cat:",
"1F4DC": ":scroll:",
"1F4BA": ":seat:",
"03299": ":secret:",
"1F648": ":see_no_evil:",
"1F331": ":seedling:",
"1F367": ":shaved_ice:",
"1F411": ":sheep:",
"1F41A": ":shell:",
"1F6A2": ":ship:",
"1F455": ":shirt:",
"1F4A9": ":shit:",
"1F45E": ":shoe:",
"1F6BF": ":shower:",
"1F4F6": ":signal_strength:",
"1F52F": ":six_pointed_star:",
"1F3BF": ":ski:",
"1F480": ":skull:",
"1F634": ":sleeping:",
"1F62A": ":sleepy:",
"1F3B0": ":slot_machine:",
"1F539": ":small_blue_diamond:",
"1F538": ":small_orange_diamond:",
"1F53A": ":small_red_triangle:",
"1F53B": ":small_red_triangle_down:",
"1F604": ":smile:",
"1F638": ":smile_cat:",
"1F603": ":smiley:",
"1F63A": ":smiley_cat:",
"1F608": ":smiling_imp:",
"1F60F": ":smirk:",
"1F63C": ":smirk_cat:",
"1F6AC": ":smoking:",
"1F40C": ":snail:",
"1F40D": ":snake:",
"1F3C2": ":snowboarder:",
"02744": ":snowflake:",
"026C4": ":snowman:",
"1F62D": ":sob:",
"026BD": ":soccer:",
"1F51C": ":soon:",
"1F198": ":sos:",
"1F509": ":sound:",
"1F47E": ":space_invader:",
"02660": ":spades:",
"1F35D": ":spaghetti:",
"02747": ":sparkle:",
"1F387": ":sparkler:",
"02728": ":sparkles:",
"1F496": ":sparkling_heart:",
"1F64A": ":speak_no_evil:",
"1F50A": ":speaker:",
"1F4AC": ":speech_balloon:",
"1F6A4": ":speedboat:",
"02B50": ":star:",
"1F31F": ":star2:",
"1F303": ":stars:",
"1F689": ":station:",
"1F5FD": ":statue_of_liberty:",
"1F682": ":steam_locomotive:",
"1F372": ":stew:",
"1F4CF": ":straight_ruler:",
"1F353": ":strawberry:",
"1F61B": ":stuck_out_tongue:",
"1F61D": ":stuck_out_tongue_closed_eyes:",
"1F61C": ":stuck_out_tongue_winking_eye:",
"1F31E": ":sun_with_face:",
"1F33B": ":sunflower:",
"1F60E": ":sunglasses:",
"02600": ":sunny:",
"1F305": ":sunrise:",
"1F304": ":sunrise_over_mountains:",
"1F3C4": ":surfer:",
"1F363": ":sushi:",
"1F69F": ":suspension_railway:",
"1F613": ":sweat:",
"1F4A6": ":sweat_drops:",
"1F605": ":sweat_smile:",
"1F360": ":sweet_potato:",
"1F3CA": ":swimmer:",
"1F523": ":symbols:",
"1F489": ":syringe:",
"1F389": ":tada:",
"1F38B": ":tanabata_tree:",
"1F34A": ":tangerine:",
"02649": ":taurus:",
"1F695": ":taxi:",
"1F375": ":tea:",
"0260E": ":telephone:",
"1F4DE": ":telephone_receiver:",
"1F52D": ":telescope:",
"1F3BE": ":tennis:",
"026FA": ":tent:",
"1F4AD": ":thought_balloon:",
"1F44E": ":thumbsdown:",
"1F44D": ":thumbsup:",
"1F3AB": ":ticket:",
"1F42F": ":tiger:",
"1F405": ":tiger2:",
"1F62B": ":tired_face:",
"02122": ":tm:",
"1F6BD": ":toilet:",
"1F5FC": ":tokyo_tower:",
"1F345": ":tomato:",
"1F445": ":tongue:",
"1F51D": ":top:",
"1F3A9": ":tophat:",
"1F69C": ":tractor:",
"1F6A5": ":traffic_light:",
"1F683": ":train:",
"1F686": ":train2:",
"1F68A": ":tram:",
"1F6A9": ":triangular_flag_on_post:",
"1F4D0": ":triangular_ruler:",
"1F531": ":trident:",
"1F624": ":triumph:",
"1F68E": ":trolleybus:",
"1F3C6": ":trophy:",
"1F379": ":tropical_drink:",
"1F420": ":tropical_fish:",
"1F69A": ":truck:",
"1F3BA": ":trumpet:",
"1F455": ":tshirt:",
"1F337": ":tulip:",
"1F422": ":turtle:",
"1F4FA": ":tv:",
"1F500": ":twisted_rightwards_arrows:",
"1F495": ":two_hearts:",
"1F46C": ":two_men_holding_hands:",
"1F46D": ":two_women_holding_hands:",
"1F239": ":u5272:",
"1F234": ":u5408:",
"1F23A": ":u55b6:",
"1F22F": ":u6307:",
"1F237": ":u6708:",
"1F236": ":u6709:",
"1F235": ":u6e80:",
"1F21A": ":u7121:",
"1F238": ":u7533:",
"1F232": ":u7981:",
"1F233": ":u7a7a:",
"02614": ":umbrella:",
"1F612": ":unamused:",
"1F51E": ":underage:",
"1F513": ":unlock:",
"1F199": ":up:",
"0270C": ":v:",
"1F6A6": ":vertical_traffic_light:",
"1F4FC": ":vhs:",
"1F4F3": ":vibration_mode:",
"1F4F9": ":video_camera:",
"1F3AE": ":video_game:",
"1F3BB": ":violin:",
"0264D": ":virgo:",
"1F30B": ":volcano:",
"1F19A": ":vs:",
"1F6B6": ":walking:",
"1F318": ":waning_crescent_moon:",
"1F316": ":waning_gibbous_moon:",
"026A0": ":warning:",
"0231A": ":watch:",
"1F403": ":water_buffalo:",
"1F349": ":watermelon:",
"1F44B": ":wave:",
"03030": ":wavy_dash:",
"1F312": ":waxing_crescent_moon:",
"1F314": ":waxing_gibbous_moon:",
"1F6BE": ":wc:",
"1F629": ":weary:",
"1F492": ":wedding:",
"1F433": ":whale:",
"1F40B": ":whale2:",
"0267F": ":wheelchair:",
"02705": ":white_check_mark:",
"026AA": ":white_circle:",
"1F4AE": ":white_flower:",
"02B1C": ":white_large_square:",
"025FD": ":white_medium_small_square:",
"025FB": ":white_medium_square:",
"025AB": ":white_small_square:",
"1F533": ":white_square_button:",
"1F390": ":wind_chime:",
"1F377": ":wine_glass:",
"1F609": ":wink:",
"1F43A": ":wolf:",
"1F469": ":woman:",
"1F45A": ":womans_clothes:",
"1F452": ":womans_hat:",
"1F6BA": ":womens:",
"1F61F": ":worried:",
"1F527": ":wrench:",
"0274C": ":x:",
"1F49B": ":yellow_heart:",
"1F4B4": ":yen:",
"1F60B": ":yum:",
"026A1": ":zap:",
"1F4A4": ":zzz:",
}
# Decode hex numbers separated by spaces into a string
def decode_points(code):
return "".join(map(lambda c: chr(int(c, 16)), code.split()))
def make_name(code):
return ":" + "".join(map(lambda c: "u" + c, code.split())) + ":"
# def fetch(url):
# return request.urlopen(url).read().decode().split("\n")
# https://unicode.org/Public/emoji/13.1/emoji-test.txt
with open(sys.argv[1]) as f:
entries = parse_lines(f)
def keep_emoji(e):
code, status, _ = e
code = code.split()
# Keep only interesting emojis (others are duplicates or won't render well)
# Remove skin tone variants, they are accessible through combinations
return status in [ "fully-qualified", "component" ] and \
not (len(code) > 1 and code[-1] in [ "1F3FB", "1F3FC", "1F3FD", "1F3FE", "1F3FF" ])
for group in entries.values():
group = list(filter(keep_emoji, group))
print("%d" % len(group))
for code, status, desc in group:
name = name_map[code] if code in name_map else make_name(code)
print("%s %s %s" % (name, decode_points(code), desc))