Skip to content

Instantly share code, notes, and snippets.

@JaHIY
Last active April 7, 2022 06:11
Show Gist options
  • Save JaHIY/60c5ee1b2e1a88e75b3e2fddded4befd to your computer and use it in GitHub Desktop.
Save JaHIY/60c5ee1b2e1a88e75b3e2fddded4befd to your computer and use it in GitHub Desktop.
convert rime dict format to fcitx dict format
#!/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