-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmoji_viewer.py
59 lines (53 loc) · 1.84 KB
/
Emoji_viewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import unicodedata
from collections import defaultdict
import unicodedata
#UnicodeのSymbol Otherを抽出しています
# reference: http://www.fileformat.info/info/unicode/category/index.htm
category_meanings = {
'Cc' : 'Other, Control',
'Cf' : 'Other, Format',
'Cn' : 'Other, Not Assigned (no characters in the file have this property)',
'Co' : 'Other, Private Use',
'Cs' : 'Other, Surrogate',
'LC' : 'Letter, Cased',
'Ll' : 'Letter, Lowercase',
'Lm' : 'Letter, Modifier',
'Lo' : 'Letter, Other',
'Lt' : 'Letter, Titlecase',
'Lu' : 'Letter, Uppercase',
'Mc' : 'Mark, Spacing Combining',
'Me' : 'Mark, Enclosing',
'Mn' : 'Mark, Nonspacing',
'Nd' : 'Number, Decimal Digit',
'Nl' : 'Number, Letter',
'No' : 'Number, Other',
'Pc' : 'Punctuation, Connector',
'Pd' : 'Punctuation, Dash',
'Pe' : 'Punctuation, Close',
'Pf' : 'Punctuation, Final quote (may behave like Ps or Pe depending on usage)',
'Pi' : 'Punctuation, Initial quote (may behave like Ps or Pe depending on usage)',
'Po' : 'Punctuation, Other',
'Ps' : 'Punctuation, Open',
'Sc' : 'Symbol, Currency',
'Sk' : 'Symbol, Modifier',
'Sm' : 'Symbol, Math',
'So' : 'Symbol, Other',
'Zl' : 'Separator, Line',
'Zp' : 'Separator, Paragraph',
'Zs' : 'Separator, Space'
}
category_to_chars = defaultdict(list)
for i in range(0, 0x110000):
ch = chr(i)
category = unicodedata.category(ch)
category_to_chars[category].append(ch)
for category in sorted(category_to_chars, key=lambda x: -len(category_to_chars[x])):
print("{} ({}): {}".format(
category,
category_meanings[category],
len(category_to_chars[category])))
CHAR_PER_LINE = 50
for i, ch in enumerate(category_to_chars['So']):
print(ch, end="")
if (i + 1) % CHAR_PER_LINE == 0:
print("<br>")