Unexpected-Keyboard icon indicating copy to clipboard operation
Unexpected-Keyboard copied to clipboard

pinyin

Open xcccdjsn opened this issue 1 year ago • 14 comments

It would be perfect if it could support pinyin input, for me

xcccdjsn avatar Mar 10 '24 02:03 xcccdjsn

This would requires word-correction/prediction ? The keyboard do not support that at the moment.

Julow avatar Mar 10 '24 19:03 Julow

Wikipedia says Pinyin is a way to express Chinese words using Roman letters. It should be doable with a custom layout and wouldn't require any new magic by Unexpected itself. There are "initials" (consonants) and "finals" (vowels), the latter modified by accents to select one of the four tones of Mandarin. It has been around for long enough that it obeyed the limitations of typewriters, so surely UNICODE has all the needed characters.

This might start with the QWERTY layout, with four swipes defined over each vowel. Or separate out the consonants from vowels, eliminate unused letters, and optimize based on native use.

Spike-from-NH avatar Mar 10 '24 21:03 Spike-from-NH

I'm looking at https://www.chinese-tools.com/tools/pinyin-editor.html —It provides a, e, i, o, u, and ü (umlaut), each with the macron, acute, grave, and caron accents, relying on UK or other soft keyboard for the initials. All these finals can already be produced by Unexpected.

To set up: Swipe the gear logo, select Add keys to the keyboard, and check the five accents you will need. Back out to the keyboard. Now, for instance, swipe umlaut, swipe acute, and type u, which you will see now appears as: ǘ!

This is awfully cumbersome, so the final step is preparing a custom layout, where all 24 (6×4) finals are a single gesture, or even have their own key. @xcccdjsn, please reply if you need help with this.

Spike-from-NH avatar Mar 11 '24 20:03 Spike-from-NH

For example, modifying my QWERTY layout: 20240311_165634

PS—I was not able to make the ǚ character, either by combining caron-umlaut-u, umlaut-caron-u, or with the new Compose key. I have a copy of the X11 mapping, but it requires a key that is not our caron prefix. Saved time by copypasting ǚ from the X11 file into my Pinyin file. Now, I was able to make it by typing caron-ü (though it was already there).

Spike-from-NH avatar Mar 11 '24 21:03 Spike-from-NH

Here's the whole keyboard: 20240311_214344 And here is the code (please remove ".txt"): Julow Pinyin.xml.txt

Spike-from-NH avatar Mar 12 '24 01:03 Spike-from-NH

@Spike-from-NH ,Thank you very much for answering my needs. Your solution is very good, but I am very sorry. I most likely expressed it wrong. Actually what I want to express is that you can input Chinese characters.

xcccdjsn avatar Mar 12 '24 17:03 xcccdjsn

This would requires word-correction/prediction ? The keyboard do not support that at the moment.

This would requires word-correction/prediction ? The keyboard do not support that at the moment.

No, as long as you can type Chinese characters normally, it will be fine. Currently, my technology is not able to meet these requirements, and I can’t trouble you too much. I would be very grateful if it could support the output of Chinese characters. This would be a perfect product for me, and of course it is great now.

xcccdjsn avatar Mar 12 '24 17:03 xcccdjsn

Actually what I want to express is that you can input Chinese characters.

@xcccdjsn, that is a lot to ask of a "lightweight keyboard." Perhaps a solution is to type Pinyin into Google Translate to get the Chinese characters. Also, the F-Droid repository has a phone app that lets you compose Chinese characters from the brush strokes.

Spike-from-NH avatar Mar 12 '24 19:03 Spike-from-NH

Actually what I want to express is that you can input Chinese characters.

@xcccdjsn, that is a lot to ask of a "lightweight keyboard." Perhaps a solution is to type Pinyin into Google Translate to get the Chinese characters. Also, the F-Droid repository has a phone app that lets you compose Chinese characters from the brush strokes.

It is indeed true, but so far I have found only this keyboard with the most complete keys and customizability. Maybe another solution can support configuration files like trime. How about trying to be compatible with trime configuration files?

xcccdjsn avatar Mar 13 '24 02:03 xcccdjsn

① That's a question for @Julow. ② Jules, perhaps copy my Pinyin XML above to your directory of useful experiments. ③ While working on this, I too "locked myself out of the house" by inserting a typo into an active layout. I used Samsung keyboard to fix the error, am unsure how I revived Unexpected. Is it worth coding a way to force a revert to QWERTY?—either by pop-up if the active layout is bad, or adding another button to the initial screen?

PS—I remember how I revived Unexpected after installing an active layout with bad syntax: I rotated the device! so as to pick up a different layout that was sound, with which to copypaste the corrected layout. Won't work for everyone.

Spike-from-NH avatar Mar 13 '24 10:03 Spike-from-NH