How to make your own table-based input method

From Fcitx
Revision as of 22:52, 2 February 2016 by Weng Xuetian (talk | contribs) (Text replacement - "<languages/>" to "<languages1/>")
Jump to navigation Jump to search

<languages1/>

File

Table-based input method requires two file, a configuration file and a data file. Which need to placed under ~/.config/fcitx/table.

Configuration File

Here is a configuration file from source of Fcitx:

[CodeTable]
UniqueName=wbpy
Name=WubiPinyin
Name[zh_CN]=五笔拼音
IconName=wbpy
File=wbpy.mb
AdjustOrder=AdjustFreq
Priority=11
UsePY=False
PYKey=z
AutoSend=-1
NoneMatchAutoSend=-1
AutoPhrase=True
SaveAutoPhrase=3
ExactMatch=False
PromptTableCode=False
Enabled=True
LangCode=zh_CN
  • Name: name of this table, it's an I18N String.
  • IconName: icon name
  • File: table data file name
  • AdjustOrder: adjust order by user input or not.
  • UsePY: uses temporary pinyin mode or not
  • PYKey: If UsePY is enabled, the start key for UsePY
  • AutoSend: When the input is longer than maximum code length, and if there is only one character, it will automatically commit the candidate or not.
  • NoneMatchAutoSend: Automatically commit the candidate string if there is no match. For example, abcd has no matched item, but abc have matched item, then the item matched abc will be committed, and d will reside in the input buffer.
  • UseMatchingKey: use wildcard or not.
  • MatchingKey: the wildcard key.
  • AutoPhrase: automatically construct new phrase.
  • AutoPhraseLength: length of automatically constructed phrase.
  • AutoPhrasePhrase: phrase will be used in automatically constructing phrase or not.
  • SaveAutoPhrase: count of the phrase need to be selected before saving an automatically constructed phrase. 0 means it will not be saved.
  • ExactMatch: Only shows the exact match item in the table.
  • PromptTableCode: Show the hint for item in this table.
  • Symbol:symbol mode key
  • SymbolFile: symbol file name
  • Enabled: enable this table or not.

Data file

Data file for table-based input method is a binary file generated by txt2mb. The origin file is a UTF-8 text file. Here is a sample for this file. Due to some historical reason, this file uses some Chinese character as configuration key.

;fcitx 版本 0x03 码表文件
键码=abcdefghijklmnopqrstuvwxy
码长=4
规避字符=;iuv
拼音=@
拼音长度=12
[组词规则]
e2=p11+p12+p21+p22
e3=p11+p21+p31+p32
a4=p11+p21+p31+n11
[数据]
a 工
a 戈
a 或
a 其
@a 阿
@a 啊
@a 呵
  • 键码: key will be used in this table, need to be ascii character.
  • 码长: Max Length for item in this table
  • 规避字符: some special table, for example Erbi, some character if appears at the head of a code, it means a special use, but it will not construct new phrase.
  • 拼音: the string start with this character means it's a pinyin.
  • 拼音长度: maximum pinyin length in this table.
  • [组词规则]
  • Rules number should be 码长 minus one.
  • On the left side of the equation, the number means the character number, e means equal, and a means large equal. For example, e3 means the character length is 3.
  • On the right side is the phrase rule, p mean normal order, n means reverse order. For example, p11 means the first code of first character, n11 means the last code of last character.
  • [数据] means the start of data. If an item contains a single character and start with ^, it means it will be used in construct phrase, but will not used in input. This is usually used by Zhengma.