* COMMENT -*- mode: org -*- #+Date: 2019-09-28 Time-stamp: <2020-01-14> * zero-pinyin-service zero-pinyin-service is a dbus service to provide pinyin input method service for zero-el pinyin input method. This allows doing arbitrarily complex things in C, while the elisp side code can be simple and efficient. You can see the dbus service interface in ./com.emacsos.zero.ZeroPinyinService1.ZeroPinyinServiceInterface.xml You can check zero-el document at https://blog.emacsos.com/zero-el.html zero-pinyin-service requires a character/word table to get candidates for pinyin preedit string. It uses libpyzy's openphrase db for this. zero-pinyin-service should know how to break pinyin and how to convert pinyin preedit string to Chinese character candidates, currently it also use libpyzy for this. So you can think of the current implementation as an adapter that makes libpyzy work with zero-el pinyin input method. This implementation is to get zero-el pinyin working with minimum effort. There are lots of improvements that can be done here. * how to build zero-pinyin-service - Get [[https://mesonbuild.com][meson build tool]] and install the ninja backend. Usually this should do: #+BEGIN_SRC sh sudo apt install meson ninja #+END_SRC You may prefer installing a newer version of meson via PyPI: #+BEGIN_SRC sh sudo apt install python3-pip python3 -m pip install --user meson ninja # add ~/.local/bin to PATH #+END_SRC - Install zero-pinyin-service dependencies #+BEGIN_SRC sh sudo apt install libglib2.0-dev libsqlite3-dev uuid-dev #+END_SRC - Build zero-pinyin-service #+BEGIN_SRC sh git clone https://gitlab.emacsos.com/sylecn/libpyzy.git cd libpyzy/src/ # Side note: zero-pinyin-service must be in libpyzy src dir to build, because # it uses the source code directly. I didn't use libpyzy as a dependency # because I have done code review and patched the libpyzy code and those # changes are not sent to upstream. libpyzy is pretty inactive these days. git clone https://gitlab.emacsos.com/sylecn/zero-pinyin-service.git cd zero-pinyin-service/ meson setup release/ cd release && ninja #+END_SRC You can install it on local system via #+BEGIN_SRC sh cd release sudo ninja install #+END_SRC Or you can build a deb and install the deb instead. - Create deb for zero-pinyin-service Create deb requires [[https://github.com/jordansissel/fpm][fpm]] tool. #+BEGIN_SRC sh fpm --version #+END_SRC At project root dir, #+BEGIN_SRC sh ./create-deb.sh #+END_SRC ** how to install fpm tool Read official doc for how to install it. The key commands are #+BEGIN_SRC sh apt install ruby ruby-dev gem install --user fpm # add ruby gem bin dir to PATH #+END_SRC * 2019-08-31 ibus-pinyin user db inference notice. zero-pinyin-service reuses ibus-pinyin's userdb at ~/.cache/ibus/pinyin/user-1.0.db This is generally not a problem. But if ibus-pinyin (libpyzy) changes their table schema in the future, zero-pinyin-service may require update. zero-pinyin-service also stores user phrase in this db. So user phrases are shared between zero-pinyin and ibus-pinyin. If you don't use ibus-pinyin, this is not a problem for you. zero-pinyin-service works fine when ibus-pinyin is not installed.