Skip to content

Commit

Permalink
修改release脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
gaboolic committed Aug 10, 2024
1 parent 86a64ea commit 5366de1
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
55 changes: 55 additions & 0 deletions others/program/dazhu/deal_ice_dict_to_dazhu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import os
import re
import string
import json
import string
import string

# 生成字母表
alphabet = list(string.ascii_lowercase)

result = []

# 生成单个字母的字符串
for letter in alphabet:
result.append(letter)

# 生成两个字母的字符串
for i in range(len(alphabet)):
for j in range(len(alphabet)):
result.append(alphabet[i] + alphabet[j])

# 生成三个字母的字符串
for i in range(len(alphabet)):
for j in range(len(alphabet)):
for k in range(len(alphabet)):
result.append(alphabet[i] + alphabet[j] + alphabet[k])

# 生成四个字母的字符串
for i in range(len(alphabet)):
for j in range(len(alphabet)):
for k in range(len(alphabet)):
for l in range(len(alphabet)):
result.append(alphabet[i] + alphabet[j] + alphabet[k] + alphabet[l])

print(len(result))
print(result[0])
print(result[-1])

read_file = open(os.path.join('cn_dicts_dazhu', "zhihu_deal_sort_merge.txt"), 'r')
write_file = open(os.path.join('cn_dicts_dazhu', "知码.txt"), 'w')


index = 0
# 逐行读取文件内容
for line in read_file:
line = line.strip()
params = line.split("\t")

if index >= len(result):
break
code = result[index]


write_file.write(f"{code}\t{params[0]}\n")
index += 1
4 changes: 2 additions & 2 deletions others/program/release/generate_rime_all_schema_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def zip_folders_and_files(zip_name, folders, files):
zipf.write(file, os.path.basename(file))

# todo
remove_list = ['cn_dicts_dazhu','others','program','recipes','./','build','sync','.DS_Store']
remove_list = ['cn_dicts_dazhu','others','program','recipes','./','build','sync','.DS_Store','frost_dict_for_fcitx5.txt']
folders = []
# 使用 os 模块中的 listdir 函数列出指定文件夹中的所有文件和子目录
files = []
Expand All @@ -41,4 +41,4 @@ def zip_folders_and_files(zip_name, folders, files):
print(folders)
print(files)

zip_folders_and_files('rime-schemas.zip', folders, files)
zip_folders_and_files('rime-frost-schemas.zip', folders, files)

0 comments on commit 5366de1

Please sign in to comment.