Zhengma Input

Introduction to Zhengma input
The Zhengma input method (郑码输入法 zhèng​mǎ shū​rù​fǎ) is a Chinese shape-based input method. In the following it will just be called Zhengma. This guide is intended for English speakers learning Chinese, and it is necessary that the reader is familiar with Chinese stroke order. It is based on personal experience and instructional material available on Wikimedia Commons.

Shape based input methods use components, that are combined to create Chinese characters. They are bound to keys on a keyboard and are typed one after another to make the combination. These are 3 examples of components and characters created by them ("day", "person", "soil"):
 * 日　=>　旦　昔　旲
 * 人　=>　亾　汆　今
 * 土　=>　在　吐　時



Practice documents and helpful sites

 * Site to look up Zhengma characters
 * Site about Zhengma with a downloadable textbook (in Chinese)
 * Zhengma 1st and 2nd roots
 * Zhengma characters

The components (roots) of Zhengma
In Zhengma the components are called roots, and there are 3 kinds of them: first main roots (第一主根), second main roots (第二主根) and secondary roots (副根). In order to better distinguish between them in English, in this guide they will be called 1st roots, 2nd roots and 3rd roots.

The 1st and 2nd roots are associated with a specific key from among the 26 keys that match the letters of the English alphabet. The 3rd roots are each associated with a combination of two keys. The key or combination of keys used to write a character or a root is called a code.

The 26 keys are organized into 5 categories depending on the first stroke of the primary1st roots of the key:
 * Keys A-H: The primary1st roots all start with a horizontal stroke,
 * Keys I-L: The primary1st roots all start with a vertical stroke,
 * Keys M-R: The primary1st roots all start with a left sliding stroke,
 * Keys S-W: The primary1st roots all start with a dot,
 * Keys X-Z: The primary1st roots all start with a bent stroke.

You can find almost all the roots in figure 1. The roots can be found on the key of the first letter of the roots code. In addition, the following 7 keys have 1 extra form of their 1st root: A, I, M, S, X, Y, Z This is the stroke associated with each category: 一 丨 丿丶㇕ ㇆ ㇄ (the letters XYZ of the "bent stroke" category each have a different bent stroke).

Each root has its own unique code, but the same root can come in different forms, for example: The 3rd root with the code “mb” usually looks like this: 牛 (it is a character by itself, meaning ox / cow), but depending on the character you write, it can for example also look like this: but it is considered the same root because its code is the same in each case. Because the same root can come in different forms, each root always have primary form(for the root ”mb” it is 牛), and possibly a number of secondary forms (like those shoved above).
 * 失 (stroke 1–3)
 * 告(stroke 1–4)
 * 牡 (stroke 1–4)
 * 偉 (stroke 9-11)

In addition to the roots, each of the 26 keys also has a whole (simplified) character associated with it. These 26 characters are all very common and are called shortcut characters, and can be written with a single letter.

In figure 1, the primary roots are shown on the left, and secondary roots on the right in parenthesis. The shortcut characters are shown in red, the 1st roots in purple, 2nd roots in green and light green-blue and the rest are 3rd roots. The characters in blue are 3rd roots written with 3 keys and similar 3rd roots written with 2 keys.

Writing characters
Take the character 利. It consists of three roots:
 * 丿 (the primary1st root of the M key)
 * 木 (the primary1st root of the F key)
 * ⺉ (the primary 2nd root of the K key)

When writing a 1st root, you just type the key it belongs to. When writing a 2nd root, you write its key and the letter d at the end. The characters code thus becomes: m + f + kd. So if you type mfkd you get the character 利.

Another example: 摔 This character consists of 6 roots:
 * ⺘ (D key primary 1st root ) +
 * ⼇ (S key secondary 1st root) +
 * ⺢ minus ⼅ (V key secondary 1st root) +
 * ㇄ (Z key primary 1st root ) +
 * 厶 (ZS primary 3rd root) +
 * 十 (E key primary 2nd root (its code is ED, remember that 2nd roots are written with an extra d)

If you add all these together, the characters code becomes: d+s+v+z+zs+ed = dsvzzsed. This is obviously too long for just one character, so Zhengma has some rules to make the actual code short:

To take the example above, you start by writing the first 2 letters: ds Then you write the first letter of the second-to-last root: z, and finally you write the first letter of the last root: e, so the actual code of 摔 becomes dsze.

When looking at figure 1, notice the large amount of forms the 2nd roots on the L key can take. Below the L key there is a box. The green characters there can all be written with the code ld when they are a part of a larger character.

Stroke order
Notice that unlike 利, 摔 doesn't quite follow stroke order. If it did, the order would be D+S+Z+ZS+V+E. In general, when one root surrounds another from above or from the sides, 	the outside part is written first, but when it is from the bottom, the inside is written first:


 * 困 jd+f
 * 周 ld+b+j
 * 兆 v+rd
 * 凶 os+zi

There are two more exceptions to zhengmas use of stroke order. When characters contains the root ⻌ (primary 1st root of the W key) or  ⼵ (secondary 1st roots of the Y key), the characters can be written either with this root written first or last. Here are a few characters and all the ways they can be written:


 * 还 giw  wgi
 * 运 bdzw  wbzs  bzw  wbz
 * 廷 ymb mby
 * 廵 zdy yzd

Character examples and 3 letter roots

 * 无 full code: a+gr. Since there are only 2 roots, you write them out completely, as long as they don't exceed 4 letters. Actual code: agr.
 * 兵 full code: pda+o. Since there are only 2 roots, you write them out completely, as long as they don't exceed 4 letters. Actual code: pdao.
 * 博 full code: ed+fb+ds. First, write the first 2 letters: ed. Then write the first letter of the last 2 codes: fd. The actual code becomes: edfd.
 * 線 full code: z+nk+kv. You start by writing the first 2 letters: zn.  Since the second root can only be written with one letter, you then focus on the remaining roots. There is only one: kv, so you write it out fully. Actual code: znkv.
 * 絡 full code: z+rs+j. You start by writing the first 2 letters: zr. Since the second root can only be written with one letter, you then focus on the remaining roots. There is only 1: j, so the actual code becomes: zrj. So even if the full code only has four letters, it might not be written out completely.

There are some roots that are written with more than two letters. They are 2nd roots that have both an extra d (like all 2nd roots) and the letter ”a” after that to distinguish the root further, or a 3rd root with the 2 letter combination and an a,b or c after it. Here are some examples:
 * 由 kia
 * 甲 kib
 * 申 kic
 * 已 yya
 * 巳 yyb
 * 入 oda
 * 丘 pda
 * 凡 qda
 * 乙 yda

Characters With V codes.
Some characters, by accident, have the same code. The characters on the right below have to be written with 2 v's after the normal code in order to distinguish them from the characters on the left. Sometimes, the code of a character collides with the code of a character combination. A later section describes how to write combinations of characters. Notice that some of the characters on the left can can be written in more than one way. They have a longer normal code, and one or two shorter codes. The shorter codes are discussed in the next section.

Writing single characters with a shorter code
Some characters can be written in a shorter way to reduce the number of keys you have to press. The characters below can be written in two or three ways. The short codes are important when you want to write multi-character words with 4 letter codes (described in the next section).


 * 统  zszr   zsz   zs
 * 新  sufp   sfp   sf
 * 岛  rzll   rll
 * 民  yybh   yhd   yh
 * 北  tirr   trz

In general, you write the 3 letter short codes by writing the ordinary 4 letter code, but try to ignore any letters that are not the first letter in a root. If you still have 4 letters, ignore the last letter. If you have less than 3 letters, you fill up with letters from the full code. Some characters seem not to follow this rule however (see 北 below). Take the first example above:

统 full code: z+s+zs+rd. Normal code: zszr. Since all the letters in the normal code are ”first letters”, you ignore the last letter of the normal code: zszr → zsz

新 full code: su+f+pd. Since u is a second letter, you ignore it: sufp → sfp

岛 full code: rf+ll. The code gets shortened to rl. The last part of the last root is l: rzll →  rll

民 full code: yyb+hd. Since the first 3 letters are one root, you ignore y and b at the end of yyb. Now you are left with only to letters of the normal code: y and h, so you have to add the d from the hd root: yybh  → yhd

北 full code: ti+rr  when the code gets shortened, it becomes tr. Normally you would add the last character from the last root and get trr. However this character doesn't seem to follow this rule. Instead, it seems you take the last stroke from the last root, which is the primary1st root of Z: tirr  → trz.

Writing multiple characters with shorter code
In addition to writing single character, it is also possible to write long sequences of characters with Zhengma. In order to do it, you have to know how to write 3 letter short codes. Here are a some examples:

When writing 2 character combinations, you write the first 2 letters from the 3 letter code:

In these 2 combination, the short form of the last character only has 1 letter, so you add a v at the end to make it a 4 letter code:

With 3 characters, you take the first letter of the first and last short code, and the first 2 letters of the middle short code:

With 4 characters, you write the first character of each character code (the first letter of the short codes are identical to the normal codes):

With more than 4 characters, you write the first character of the first 4 character codes and ignore the rest:

Suggestions for studying
1: open the site https://zhengma.911cha.com/ and use it to look up the Zhengma code of characters you have trouble writing (write the character in the search bar). You can also print out the image of the Zhengma keyboard as a reference.

2: Memorize the 5 groups of keys mentioned above (they each start with the letters A,I,M,S,X).

3: For each group, memorize the 1st and 2nd roots, and perhaps the shortcut characters, using pen and paper.

4: Use the practice document to memorize the 3rd roots. When you know the 1st and 2nd roots, it becomes easier to guess/memorize the code of the 3rd roots.

5: Use the second practice document to practice writing actual characters. These characters were chosen as often occurring and relatively hard to write, so if you can write these you should be in a good position to use Zhengma.