Mozc

From ArchWiki
Revision as of 09:44, 28 September 2012 by Blowback (Talk | contribs) (split from Input Japanese using uim)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Mozc

Mozc (on AUR) is a Japanese open source input method that originates from Google Japanese Input. It is considered to have better conversion quality than Anthy as for multi segments conversion (e.g. one sentence) in a lump but the dictionary is not as complete as Google Japanese Input. Though Mozc adapts to only ibus input method framework, macuim provides uim-mozc plugin and you can use it with mozc-svnAUR or mozc-utAUR on AUR.

  • mozc-svnAUR
    • mozc-svn builds with the published svn repository instead of source tarball and can build uim-mozc plugin.
      Note: If you do not use uim (use ibus), you should not use mozc-svn. It is exactly similar to mozc (published svn repository is not actually trunk) and run-time of makepkg of mozc-svn will be longer than mozc.
  • mozc-utAUR
    • mozc-ut comes with Mozc UT dictionary and can build uim-mozc plugin. The dictionary adds over 350,000 words into original.
      Note: Building mozc-ut requires further long time to generate dictionary seed.

Each packages consist as follows:

Package mozc mozc-svn mozc-ut description
Group mozc-im mozc-im-svn mozc-im-ut
Component mozc mozc-svn mozc-ut Server part of the Mozc
ibus-mozc ibus-mozc-svn ibus-mozc-ut IBus engine module (optional)
N/A uim-mozc-svn uim-mozc-ut uim plugin module (optional)
N/A fcitx-mozc-svn N/A Fcitx module (optional)
emacs-mozc emacs-mozc-svn emacs-mozc-ut Mozc for Emacs (optional)
Using Unofficial user repository

There is an unofficial user repository of Mozc. Add the following into /etc/pacman.conf.

[pnsft-pur]
Server = http://downloads.sourceforge.net/project/pnsft-aur/pur/$arch
Note: This repo provides x86_64 packages only.

You can choose install packages of Mozc as follows:

# pacman -S mozc-im (Or mozc-im-svn / mozc-im-ut)

Or, specify package names directly. For example:

# pacman -S uim-mozc-svn emacs-mozc-svn
Compiling Mozc for uim using PKGBUILD
Prepare building Mozc

Mozc requires the following packages to be built in addition to its depending packages:

Install zinniaAUR from AUR before building Mozc.

Edit PKGBUILD

First, you get mozc-svnAUR or mozc-utAUR tarball from the AUR and edit the PKGBUILD to enable uim-mozc. That is, uncomment _uim_mozc line and you can comment out _ibus_mozc line to disable ibus module if unnecessary:

## You can choose the input method framework to use either ibus, uim or both.
## If you will be not using ibus, comment out below.
#_ibus_mozc="yes"
## If you will be using uim, uncomment below.
_uim_mozc="yes"

If you will be using mozc.el on Emacs instead of uim.el, uncomment _emacs_mozc line.

## If you will be using mozc.el on Emacs, uncomment below.
_emacs_mozc="yes"
Build and install

Finally, build and install:

$ makepkg -s -i
Re-register Mozc on uim

You must run the following command whenever you upgrade or (re-)install uim.

# uim-module-manager --register mozc
Tips
Launching Mozc tools from commandline

The followings are commands to launch mozc tools.

  • Mozc property:
    $ /usr/lib/mozc/mozc_tool --mode=config_dialog
  • Mozc Dictionary Tool:
    $ /usr/lib/mozc/mozc_tool --mode=dictionary_tool
  • Mozc word register:
    $ /usr/lib/mozc/mozc_tool --mode=word_register
  • Mozc hand writing tool:
    $ /usr/lib/mozc/mozc_tool --mode=hand_writing
  • Mozc character palette:
    $ /usr/lib/mozc/mozc_tool --mode=character_palette
Use CapsLock as Eisu_toggle key on ASCII layout keyboard

Most of the preset keymap styles of Mozc, command 'ToggleAlphanumericMode' on 'Composition' mode is assigned to Eisu (Eisu_toggle), Hiragana/Katakana or Muhenkan key, but the ASCII keyboard has none of them.

One of the solution for it is to use CapsLock key as Eisu_toggle (Mozc does not recognize CapsLock key). The following is way to assign the Eisu_toggle to CapsLock (without any modifier keys) and the Caps_Lock to Shift + CapsLock, like OADG keyboard layout.

Warning: This way affects to desktop wide.

Edit the ~/.Xmodmap as follows:

keycode 66 = Eisu_toggle Caps_Lock
clear Lock

Then, restart X or run xmodmap to apply immediately:

$ xmodmap ~/.Xmodmap

Using mozc.el

If you use Mozc, you can use mozc.el. Write the following settings into your .emacs.d/init.el or some other file for Emacs customizing.

(require 'mozc)  ; or (load-file "/path/to/mozc.el")
(setq default-input-method "japanese-mozc")

mozc.el provides "overlay" mode in the styles of showing candidates (from mozc r77) similar to the inline candidates displaying mode of uim.el. If you want to use overlay mode, add the following.

(setq mozc-candidate-style 'overlay)