forked from 0-inf/KoreanBadwordDetection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileMaker.py
65 lines (53 loc) · 5.06 KB
/
FileMaker.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
60
61
62
63
64
65
"""
Base 데이터
"""
Base_layer = {'ㄱ':100,'ㄲ':100.5,'ㅋ':101.5,'ㄴ':110,'ㄹ':120,'ㄷ':130,'ㄸ':130.5,'ㅌ':131.5,'ㅂ':140,'ㅃ':140.5,
'ㅍ':141.5,'ㅅ':150,'ㅆ':150.5,'ㅎ':160,'ㅈ':170,'ㅉ':170.5,'ㅊ':171.5,'ㅇ':180,'ㅁ':190,
'ㅣ':300,'ㅟ':301,'ㅔ':310,'ㅚ':311,'ㅐ':320,'ㅡ':301,'ㅜ':302,'ㅓ':311,'ㅗ':312,'ㅏ':321,
'ㅕ':311.5,'ㅑ':320.5,'ㅛ':312.5,'ㅠ':302.5,'ㅒ':320.5,'ㅖ':310.5,'ㅢ':300.5,'ㅘ':321.5,'ㅙ':320.5,'ㅝ':311.5,'ㅞ':310.5}
"""
layer raw 데이터
"""
Seem_layer_raw = {'/': ('ㅣ', 1.0), '|': ('ㅣ', 0.0), '1': ('ㅣ', 0.5), 'r': ('ㅏ', 1.5), '^': ('ㅅ', 0.5), '•': ('ㅇ', 1.0), '○': ('ㅇ', 0.5),'¡': ('ㅣ',1),
'●': ('ㅇ', 1.0), '0': ('ㅇ', 1.0), 'O': ('ㅇ', 1.0), 'o': ('ㅇ', 1.0), '@': ('ㅇ', 3.0), '°': ('ㅇ', 2.5), '¤': ('ㅇ', 2.5),
'□': ('ㅁ', 1.0), '■': ('ㅁ', 1.5), '◇': ('ㅇ', 2.0), 'H': ('ㅐ', 1.0), 'F': ('ㅑ', 1.0), 'l': ('ㅣ', 0.5), '*': ('ㅇ', 3.0),
'!': ('ㅣ', 1.0), 'ᄀ': ('ㄱ', 0), 'ᄁ': ('ㄲ', 0), 'ᄂ': ('ㄴ', 0), 'ᄃ': ('ㄷ', 0), 'ᄄ': ('ㄸ', 0), 'ᄅ': ('ㄹ', 0), 'ᄆ': ('ㅁ', 0),
'ᄇ': ('ㅂ', 0), 'ᄈ': ('ㅃ', 0), 'ᄉ': ('ㅅ', 0), 'ᄊ': ('ㅆ', 0), 'ᄋ': ('ㅇ', 0), 'ᄌ': ('ㅈ', 0), 'ᄍ': ('ㅉ', 0), 'ᄎ': ('ㅊ', 0),
'ᄏ': ('ㅋ', 0), 'ᄐ': ('ㅌ', 0), 'ᄑ': ('ㅍ', 0), 'ᄒ': ('ㅎ', 0), 'ᄼ': ('ㅅ', 1), 'ᄽ': ('ㅆ', 1), 'ᄾ': ('ㅅ', 1), 'ᄿ': ('ㅆ', 1),
'ᅀ': ('ㅅ', 1), 'ᅌ': ('ㅇ', 1), 'ᅎ': ('ㅈ', 1), 'ᅏ': ('ㅉ', 1), 'ᅐ': ('ㅈ', 1), 'ᅑ': ('ㅉ', 1), 'ᅔ': ('ㅊ', 1), 'ᅕ': ('ㅊ', 1),
'ᅙ': ('ㅎ', 0.5), 'ᅡ': ('ㅏ', 0), 'ᅢ': ('ㅐ', 0), 'ᅣ': ('ㅑ', 0), 'ᅤ': ('ㅒ', 0), 'ᅥ': ('ㅓ', 0), 'ᅦ': ('ㅔ', 0), 'ᅧ': ('ㅕ', 0),
'ᅨ': ('ㅖ', 0), 'ᅩ': ('ㅗ', 0), 'ᅪ': ('ㅘ', 0), 'ᅫ': ('ㅙ', 0), 'ᅬ': ('ㅚ', 0), 'ᅭ': ('ㅛ', 0), 'ᅮ': ('ㅜ', 0), 'ᅯ': ('ㅝ', 0.5),
'ᅰ': ('ㅞ', 0.5), 'ᅱ': ('ㅟ', 0), 'ᅲ': ('ㅠ', 0), 'ᅳ': ('ㅡ', 0), 'ᅴ': ('ㅢ', 0), 'ᅵ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 0), 'k': ('ㅏ', 0), 'K': ('ㅏ', 0), 'l': ('ㅣ', 0), 'L': ('ㅣ', 0), 'z': ('ㅋ', 0), 'Z': ('ㅋ', 0),
'x': ('ㅌ', 0), 'X': ('ㅌ', 0), 'c': ('ㅊ', 0), 'C': ('ㅊ', 0), 'v': ('ㅍ', 0), 'V': ('ㅍ', 0), 'b': ('ㅠ', 0), 'B': ('ㅠ', 0),
'n': ('ㅜ', 0), 'N': ('ㅜ', 0), 'm': ('ㅡ', 0), 'M': ('ㅡ', 0)}
Pro_layer_raw = {'a': ('ㅏ', 0), 'A': ('ㅏ', 0), 'o': ('ㅗ', 0), 'O': ('ㅗ', 0), 'u': ('ㅜ', 0), 'U': ('ㅜ', 0), 'i': ('ㅣ', 0), 'I': ('ㅣ', 0),
'e': ('ㅔ', 0), 'E': ('ㅔ', 0), 'g': ('ㄱ', 0), 'G': ('ㄱ', 0), 'k': ('ㅋ', 0), 'K': ('ㅋ', 0), 'd': ('ㄷ', 0), 'D': ('ㄷ', 0),
't': ('ㅌ', 0), 'T': ('ㅌ', 0), 'b': ('ㅂ', 0), 'B': ('ㅂ', 0), 'p': ('ㅍ', 0), 'P': ('ㅍ', 0), 'j': ('ㅈ', 0), 'J': ('ㅈ', 0),
's': ('ㅅ', 0), 'S': ('ㅅ', 0), 'h': ('ㅎ', 0), 'H': ('ㅎ', 0), 'n': ('ㄴ', 0), 'N': ('ㄴ', 0), 'm': ('ㅁ', 0), 'M': ('ㅁ', 0),
'r': ('ㄹ', 0), 'R': ('ㄹ', 0), 'l': ('ㄹ', 0), 'L': ('ㄹ', 0)}
"""
raw 데이터를 base 데이터로 코딩
"""
Seem_layer = {}
KeyBoard_layer = {}
Pro_layer = {}
for i in Seem_layer_raw:
Seem_layer[i]=Base_layer[Seem_layer_raw[i][0]]+float(Seem_layer_raw[i][1])
for i in KeyBoard_layer_raw:
KeyBoard_layer[i]=Base_layer[KeyBoard_layer_raw[i][0]]+float(KeyBoard_layer_raw[i][1])
for i in Pro_layer_raw:
Pro_layer[i]=Base_layer[Pro_layer_raw[i][0]]+float(Pro_layer_raw[i][1])
import pickle
with open('WDLD.txt', 'wb') as file:
pickle.dump(Base_layer, file)
pickle.dump(Seem_layer, file)
pickle.dump(KeyBoard_layer, file)
pickle.dump(Pro_layer, file)