From 77e0efd3de354ea415264cd73e950eb684353c05 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 17 Jan 2021 00:12:19 +0100 Subject: 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. --- emoji_gen.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'emoji_gen.py') diff --git a/emoji_gen.py b/emoji_gen.py index 9955364..e3bef98 100644 --- a/emoji_gen.py +++ b/emoji_gen.py @@ -891,8 +891,18 @@ def make_name(code): 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, _, desc in 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)) -- cgit v1.2.3