Skip to content

Instantly share code, notes, and snippets.

Created August 30, 2015 19:39
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 anonymous/302304d042676074274d to your computer and use it in GitHub Desktop.
Save anonymous/302304d042676074274d to your computer and use it in GitHub Desktop.
Ibus template and install instructions for tone marked chinese pinyin input
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
### File header must not be modified
### This file must be encoded into UTF-8.
### This table under LGPL
### comments start with ### not single #
### Derive from the format of SCIM Table, so you can modify the table from
### scim-tables' table
SCIM_Generic_Table_Phrase_Library_TEXT
VERSION_1_0
### How to install me (assuming ibus and ibus-table are already installed)
### Instructions from: http://www.studymongolian.net/technical/how-to-create-linux-input-method-editor/
### Save me somewhere as zh_pinyin.txt
### Open a terminal and cd to that folder, then:
### $ sudo ibus-table-createdb -n /usr/share/ibus-table/tables/zh_pinyin.db -s zh_pinyin.txt
### If you have an icon:
### $ sudo cp your-icon.svg /usr/share/ibus-table/icons/
### Restart ibus
### $ ibus-daemon -drx
### Open ibus settings:
### $ ibus-setup
### Click the “Input Method” tab and check the “Customize active input methods” box.
### Click the “Select an input method” dropdown list and chose English and then pinyin.
### Then click the “Add” button. Close the dialog. Then open some program that you can write in.
### Click the IBus keyboard icon and you should see your new input method available.
### Click it and the icon should change into the one for your IM.
### You should be able to write in your new IME now.
### Begin Table definition.
BEGIN_DEFINITION
### License
LICENSE = LGPL
### An unique id to distinguish this table among others.
### Use uuidgen to generate this kind of id.
UUID = 3df9d538-9cf1-40b2-80b6-51ce8da09aa6
### A unique number indicates the version of this file.
### For example the last modified date of this file.
### This number must be less than 2^32.
### Just make your table version-able
SERIAL_NUMBER = 20150830
### ICON can be any format as long as your pygtk can recognized
### the most widely ones are "png" and "svg", letter one is recommended
ICON = zh_pinyin.svg
### The default name of this table, this is needed
NAME = zh_pinyin
### The local names of this table, this is optional
### NAME.zh_CN = 形码
### NAME.zh_HK = 形碼
### NAME.zh_TW = 形碼
### Description
DESCRIPTION = For entering pinyin with tone marks
### Supported languages of this table
### sigle "zh_CN" just be recognized as zh_CN,
### but "zh_CN, zh_HK" or more zh_XX will be recognized as zh;
### and "en_US, zh_CN" will be just ignored.
LANGUAGES = en_US
### The author of this table
AUTHOR = fzzylogic
### Prompt string to be displayed in the status area, CN will be replaced by
### the gettext tools in runtime as 中.
STATUS_PROMPT = PY
### Valid input chars.
VALID_INPUT_CHARS = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
### Layout
LAYOUT = us
### The max number of input keys for every phrase or character.
MAX_KEY_LENGTH = 5
### Use auto_commit mode as default
### This means the symbol is outputted immediately
AUTO_COMMIT = TRUE
### Automatically selects the first phrase when typing
AUTO_SELECT = TRUE
### Use full width punctuation by default
DEF_FULL_WIDTH_PUNCT = FALSE
### Not use full width letter by default
DEF_FULL_WIDTH_LETTER = FALSE
### Whether user are allow to define phrase, default is true
### You have to define the word construction rules below.
### For input methods which do not input phrases, set this to False
USER_CAN_DEFINE_PHRASE = TRUE
### Whether support PinYin Mode, default is true.
### this feature is just for Chinese, set it to False if your IM is not
### Chinese.
PINYIN_MODE = FALSE
### If true then the phrases' frequencies will be adjusted dynamically
### according your using frequency.
DYNAMIC_ADJUST = FALSE
### Some characters whose frequencies should be fix all the time, e.g.
### some punctuations
### NO_CHECK_CHARS =
### Rules for constructing user defined phrase
### "ce" stands for "ci equal", a Chinese English :), means "phrase length
### equal to", thus ce2 -> phrase length equal to 2; and "ca" means "phrase
### length equal or above", so ca4 -> phrase length equal or above 4.
### p21 -> the 1st key of 2nd character in the phrase, and so on.
### Each rule separate via ";".
### Example below is a complete rule-set,
### becuase [2,2] ∩ [3,3] ∩ [4,+∞] = [2,+∞], which is the range of length
### of phrase. This have to be satisfied if you need ibus-table to build up
### your own inputed phrase via your daily using.
### RULES = ce2:p11+p12+p21+p22;ce3:p11+p21+p22+p31;ca4:p11+p21+p31+p41
### The key strokes to page up the lookup table.
### PAGE_UP_KEYS = Page_Up,KP_Page_Up,minus,comma
### The key strokes to page down.
### PAGE_DOWN_KEYS = Page_Down,KP_Page_Down,equal,period
END_DEFINITION
### Begin Table data.
### Format of every line whose formated in "input_keys\tphrase\tfreq\n" is an
### entry.
### From left to right, the 1st column are the input key combination that you
### entered via keyboard; the 2nd column are presented character or phrase of
### the key combination you want; the 3rd column are frequency of the character
### or phrase.
BEGIN_TABLE
ang5 ang 2
ang1 āng 1
ang2 áng 1
ang3 ǎng 1
ang4 àng 1
eng5 eng 2
eng1 ēng 1
eng2 éng 1
eng3 ěng 1
eng4 èng 1
ing5 ing 2
ing1 īng 1
ing2 íng 1
ing3 ǐng 1
ing4 ìng 1
on5 on 2
ong5 ong 2
ong1 ōng 1
ong2 óng 1
ong3 ǒng 1
ong4 òng 1
va5 va 2
van5 van 2
van1 üān 1
van2 üán 1
van3 üǎn 1
van4 üàn 1
ai5 ai 2
ai1 āi 1
ai2 ái 1
ai3 ǎi 1
ai4 ài 1
an5 an 2
an1 ān 1
an2 án 1
an3 ǎn 1
an4 àn 1
ao5 ao 2
ao1 āo 1
ao2 áo 1
ao3 ǎo 1
ao4 ào 1
ei5 ei 2
ei1 ēi 1
ei2 éi 1
ei3 ěi 1
ei4 èi 1
en5 en 2
en1 ēn 1
en2 én 1
en3 ěn 1
en4 èn 1
er5 er 2
er1 ēr 1
er2 ér 1
er3 ěr 1
er4 èr 1
ia5 ia 2
ia1 iā 1
ia2 iá 1
ia3 iǎ 1
ia4 ià 1
ie5 ie 2
ie1 iē 1
ie2 ié 1
ie3 iě 1
ie4 iè 1
in5 in 2
in1 īn 1
in2 ín 1
in3 ǐn 1
in4 ìn 1
iu5 iu 2
iu1 iū 1
iu2 iú 1
iu3 iǔ 1
iu4 iù 1
ou5 ou 2
ou1 ōu 1
ou2 óu 1
ou3 ǒu 1
ou4 òu 1
ua5 ua 2
ua1 uā 1
ua2 uá 1
ua3 uǎ 1
ua4 uà 1
ui5 ui 2
ui1 uī 1
ui2 uí 1
ui3 uǐ 1
ui4 uì 1
un5 un 2
un1 ūn 1
un2 ún 1
un3 ǔn 1
un4 ùn 1
uo5 uo 2
uo1 uō 1
uo2 uó 1
uo3 uǒ 1
uo4 uò 1
ve5 ve 2
ve1 üē 1
ve2 üé 1
ve3 üě 1
ve4 üè 1
vn5 vn 2
vn1 ǖn 1
vn2 ǘn 1
vn3 ǚn 1
vn4 ǜn 1
a5 a 2
a1 ā 1
a2 á 1
a3 ǎ 1
a4 à 1
e5 e 2
e1 ē 1
e2 é 1
e3 ě 1
e4 è 1
i5 i 2
i1 ī 1
i2 í 1
i3 ǐ 1
i4 ì 1
o5 o 2
o1 ō 1
o2 ó 1
o3 ǒ 1
o4 ò 1
u5 u 2
u1 ū 1
u2 ú 1
u3 ǔ 1
u4 ù 1
v5 v 2
v1 ǖ 1
v2 ǘ 1
v3 ǚ 1
v4 ǜ 1
v5 ü 1
END_TABLE
### Since some input methods use different table for every character to make
### phrase, such as ZhengMa, they need explict define the goucima (the
### phrase-building code for the given character), the format of every entry is
### "character\tgoucima\n".
### For the input method which just use the full code as word-building code
### just skip this field. The ibus-table will build the codes needed from
### above TABLE.
### if you don't need different word-building code, please comment out the
### next few lines with ###, just like these lines you are look at now.
### BEGIN_GOUCI
### character_1 goucima_1
### character_1 goucima_2
### END_GOUCI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment