Last active
April 7, 2022 06:11
-
-
Save JaHIY/60c5ee1b2e1a88e75b3e2fddded4befd to your computer and use it in GitHub Desktop.
convert rime dict format to fcitx dict format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
# Requirement: | |
# - pypinyin | |
# - sed | |
# How to use | |
# $ ./rime2fcitx.awk '/usr/share/rime-data/opencc/emoji_category.txt' > emoji_category_fcitx.txt | |
BEGIN { | |
FS = OFS = "\t"; | |
} | |
{ | |
cmd = "pypinyin -s NORMAL " $1 " | sed \"s/[[:space:]]/'/g\"" | |
cmd | getline pinyin; | |
close(cmd); | |
split($2, emoji_array, " "); | |
s = length(emoji_array); | |
for (i = 2; i < s; i += 1) { | |
print(emoji_array[i], pinyin, "0.9"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment