Difference between revisions of "How to make your own table-based input method"

From Fcitx
Jump to navigation Jump to search
m (Text replacement - "<translate>" to "<translate1>")
m (Text replacement - "<translate1>" to "<translate>")
Line 1: Line 1:
== File ==
== File ==
Table-based input method requires two file, a configuration file and a data file. Which need to placed under ~/.config/fcitx/table.
Table-based input method requires two file, a configuration file and a data file. Which need to placed under ~/.config/fcitx/table.

Latest revision as of 22:54, 2 February 2016


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:

  • 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 码表文件
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.