-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck4wc.py
executable file
·57 lines (47 loc) · 1.15 KB
/
check4wc.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
#!/usr/bin/env python3
import time
ch_list = ['']
#replace_with_backtick('啊', s)
pstring1 = ''
pstring2 = ''
with open('flypy.dict.yaml', encoding='utf-8') as f:
for line in f:
if not '\t' in line:
continue
string1, string2 = line.strip().split('\t')
if (len(string1) == 1 and len(string2) == 4):
if (pstring2 == string2):
ch_list.append(pstring1 + '\t' + pstring2)
ch_list.append(string1 + '\t' + pstring2)
pstring1 = string1
pstring2 = string2
for string in ch_list:
print(string)
dict_head = '''---
name: flypywc
version: "{}"
sort: original
wildcard: "`~"
columns:
- text
- code
- weight
- stem
encoder:
rules:
- lengh_equal: 1
formula: "AaAz"
- length_equal: 2
formula: "AaAbBaBb"
- length_equal: 3
formula: "AaAbBaCa"
- length_in_range: [4, 10]
formula: "AaBaCaZa"
...
'''
dict_head = dict_head.format(time.time())
#with open('flypywc.dict.yaml', "w", encoding='utf-8') as f:
# f.write(dict_head)
# for string in ch_list:
# f.write(string)
# f.write('\n')