Skip to content

Instantly share code, notes, and snippets.

@AllanChain
Created June 12, 2023 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllanChain/9b07b6181e9040b2d23fb8caddc5a247 to your computer and use it in GitHub Desktop.
Save AllanChain/9b07b6181e9040b2d23fb8caddc5a247 to your computer and use it in GitHub Desktop.
自然快手辅助码转移
zrmfast = {}
for line in open('./zrmfast.dict.yaml'):
if not '\t' in line or not '[' in line:
continue
char, code, *_ = line.strip().split('\t')
zrmfast[char] = code.split('[')[1]
lines = []
for line in open('/usr/share/rime-data/luna_pinyin.dict.yaml'):
if not '\t' in line:
continue
char, code, *extra = line.strip().split("\t")
aux = zrmfast.get(char)
if aux is None:
continue
line = "\t".join([char, code+";"+aux, *extra])
lines.append(line + '\n')
with open ('./lunafast.dict.yaml', 'w') as f:
f.writelines(lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment