summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2021-04-02 03:37:29 +0200
committeremkael <emkael@tlen.pl>2021-04-02 03:37:29 +0200
commitbb8d5d0520e078f157448a7d3b4ce196f447a627 (patch)
tree5c914af2d96513ef75d28f06e44130c7e6ee8ce6 /bin
parent24bd87bcaf315c761f85dc898fcaf9a715b630c4 (diff)
Filtering out Unicode retard-speak
Diffstat (limited to 'bin')
-rw-r--r--bin/emoji-list.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/emoji-list.py b/bin/emoji-list.py
index 31ba4b1..823347d 100644
--- a/bin/emoji-list.py
+++ b/bin/emoji-list.py
@@ -1,4 +1,5 @@
import json, os, urllib
+import xml.etree.ElementTree as ET
emoji_list = json.load(urllib.urlopen(
'https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json'
@@ -9,6 +10,13 @@ for emoji in emoji_list:
name = emoji['name'].replace(' ', '_') if emoji['name'] else emoji['short_name'].upper().replace('-', '_')
dictionary[character] = ' [%s] ' % (name)
+retardspeak_map = ET.fromstring(urllib.urlopen(
+ 'http://slothsoft.net/getResource.php/slothsoft/unicode-mapper'
+).read())
+for letter in retardspeak_map.findall('.//letter'):
+ if letter.attrib['target'] != letter.attrib['source']:
+ dictionary[letter.attrib['target']] = letter.attrib['source']
+
json.dump(dictionary, file(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'../config/emoji.json'