Recently, I have been learning Wubi typing. On one hand, it is to make up for the regret of not learning it well thirty years ago (when I was young, I only memorized the Wubi mnemonic). On the other hand, as I age, my physical strength is not what it used to be, and typing has become difficult, while Wubi requires fewer keystrokes. Although language input methods are now widely used, writing articles still requires inspiration to come word by word. The first step is to obtain a character database.

Using awk, I split it into two txt files, with the split content as follows:

Based on the above content, I wrote the code in Python.

Run the code for testing.

Upon running, we find that by inputting a Chinese character, we can obtain the corresponding Wubi code. There may be a few Chinese characters that cannot find a corresponding [a-z], and we just need to append them in the two txt files above.