timdream / jszhuyin

JS 注音:JavaScript 自動選字注音輸入法;"Smart" Chinese Zhuyin Input Method in JavaScript.
https://jszhuyin.timdream.org/
MIT License
223 stars 19 forks source link

Encode sounds with a mapping table instead of with a Bopomofo encoding #35

Closed timdream closed 7 years ago

timdream commented 7 years ago

The number of sound is way smaller (10 or 11bits?) than all possible Bopomofo combinations (15bit). I couldn't find a number right now but it's possible to save two bytes for each sound if we store Bopomofo symbls to sound mapping in anther table.

This is non-trivial and would require a write write to the storage and the search algorithm, but with this it would be trivial to implement Pinyin input.

timdream commented 7 years ago

The number of sound is way smaller (10 or 11bits?)

There should be around ~1000 sounds (tone included). IIRC the output I ran through a small program on the data.txt.

timdream commented 7 years ago

This won't help reduce the storage size as we would always need two bytes. If that's the case there isn't any point to do a mapping table.