Chinese Typewriter

  • defaultuser0
    19th November Member 0 Permalink
    I made a typewriter for Simplified Chinese! ID:3306077
    Usage: For each character you want to write, type the pinyin in.
    Then, click the checkmark button to show the top 8 candidates.
    You can also press the X button to clear the current pinyin. 
    There is also a backspace and enter key, as well as punctuation keys.
     
    Due to hash collisions, you may get unrelated characters! I cannot solve this, only mitigate it.
    If you can't type a character you want, then you have to draw it yourself, sorry :(
     
    Source code (FILT): https://gist.github.com/uint128-t/085b05adb7ce6838d759ff8b9ed07744
    Font: Noto Sans Simplified Chinese https://fonts.google.com/noto/specimen/Noto+Sans+SC
    Database: Jun Da Character frequency list of Modern Chinese https://lingua.mtsu.edu/chinese-computing/statistics/
    Note: The code will try to find a good mapping for each letter of the alphabet by randomizing it many times. 
    That means each keyboard key will require a different FILT value, shown in the program's output.
    When it is done, it will also save a Lua script to be directly run with dofile in the console.
     
    Typing Examples:
    (unicode doesn't work in the forum??)
    ni (1) hao (1)
    chuang (4) qian (1) ming (1) yue (1) guang (1)
     
    How it works:
    It computes a hash from the pinyin into a number from 0 to 478. The Python implementation for it is in the source code. This WILL cause collisions, but for typing basic sentences, it works. This does mean that you will get unrelated characters, because different pinyin can have the same hash.
     
    You can use parts of this in your saves. You're also more than welcome to adapt this for other languages, etc!
    Just please provide attribution! ??!
    Edited 2 times by defaultuser0, jacob1. Last: 0:13:42