Mozc - ArchWiki

# Mozc

From ArchWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

From the project's home page:

  Mozc is a Japanese input method editor (IME) designed for multi-platform such as Android OS, Apple OS X, Chromium OS, GNU/Linux and Microsoft Windows. This OpenSource project originates from Google Japanese Input.

The differences between Mozc and Google Japanese Input are described in detail at the project's About Branding page, but in short, Mozc's open-source code does not include Google's extensive word conversion tables (so called "dictionaries"), so its conversion quality is not equivalent to that of Google's branded product. This can be mostly mitigated with custom dictionaries though (see below).

## Installation

There are several available Mozc packages to choose from, and depending on your needs there are some precautions that should be taken into consideration:

Besides its core files, Mozc also requires modules to integrate with the various input method frameworks (IMF); a separate module is needed for each of Fcitx, IBus, Uim and Emacs (which contains its own internal IMF).

Most Mozc packages split the core and the IMF module into separate parts, but some of the Fcitx packages (including the one in the official repository) instead come with the Mozc core and the Fcitx module combined into a single package.

Note: Trying to install these combined packages alongside any other Mozc package will produce conflicts. If for some reason you'll be needing more than one IMF modules active at the same time, the solution is to either build the offending packages yourself and manually resolve any conflicts, or to choose a different package combination.

On the other hand, some of the seemingly standalone IBus, Uim and Emacs packages are actually a single, split PKGBUILD that can install one or more IMF modules at the same time, by using toggles to enable or disable them; e.g. mozc-ut2AUR is the package actually responsible for building ibus-mozc-ut2AUR, emacs-mozc-ut2AUR and uim-mozc-ut2AUR:

    ## Build configuration
    ##
    ## You can choose the input method framework to use either ibus and/or uim.
    ## If you will not be 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, uncomment below.
    #_emacs_mozc="yes"

Note: Care must be taken to properly enable or disable the desired toggles before installing such a package so that the correct modules will be installed.

Last, but certainly not least, there exists a family of custom dictionaries that can elevate Mozc's conversion quality to more closely resemble that of Google Japanese Input: The UT, UT2 and NEologd UT dictionaries. The first two contain extra words aggregated from several popular online sources (based on hit numbers from Google/Yahoo and Wikipedia, respectively) while the third one is based on the mecab-ipadic-NEologd Neologism dictionary, which contains "neologisms (new words), which are extracted from many language resources on the Web", in the words of its creator.

The UT dictionary was deprecated in 2016 in favor of UT2 and NEologd UT, which were both intended to be its successors; but as of November 2020, UT has been revived into an updated version that now also incorporates the UT2 and NEologd dictionaries, which have in turn been deprecated themselves (source: UT home page).

Tip: The short version of the above is that in most cases the Mozc packages based on the UT dictionary should be preferable.

The following table shows the various packages available; purple cells indicate combined packages, while yellow cells indicate packages containing toggles for additional modules. Some of these packages can also be found in the pnsft-pur repository.

| Fcitx | Fcitx5 | IBus | Emacs | Uim
--- | --- | --- | --- | --- | ---
Official | fcitx-mozc | fcitx5-mozc | ibus-mozcAUR | emacs-mozcAUR | uim-mozcAUR
UT | fcitx-mozc-utAUR | fcitx5-mozc-utAUR | ibus-mozc-utAUR | emacs-mozc-utAUR |
fcitx-mozc-ut-unifiedAUR |  | ibus-mozc-ut-unitedAUR | emacs-mozc-ut-unitedAUR
UT2 | fcitx-mozc-ut2AUR |  | ibus-mozc-ut2AUR | emacs-mozc-ut2AUR | uim-mozc-ut2AUR
NEologd UT | fcitx-mozc-neologd-utAUR |  |  |

Note: Once Mozc is installed, you may need to restart X or your input method framework before you can use it.

## Configuration

### IBus

See also IBus for IBus configuration.

If you use Mozc by default, set it up via ibus-setup:

    $ ibus-setup

Choose Input Method tab and move Mozc to top of the list.

You can switch input method by `Alt+Shift_L` (as per the IBus default).

Tip: When used with IBus, by default Mozc will launch in Direct (Eisu) input mode, which can be problematic on keyboards that lack the Eisu key. To change this behavior and make Mozc launch in Hiragana input mode instead, edit `~/.config/mozc/ibus_config.textproto` and append the following line:

    ~/.config/mozc/ibus_config.textproto

    ...
    }
    active_on_launch: True

### uim

See also Uim for uim configuration.

Configure uim preferences by running:

    $ uim-pref-gtk (Or, uim-pref-gtk3/uim-pref-qt4)

which brings forth a GUI.

Choose your preferring input method as Default input method.

Note: Mozc will be not listed in Default input method at first time so you will need to add it into Enabled input methods to use.
Warning: You must run the following command whenever you upgrade or (re-)install uim.
# uim-module-manager --register mozc

### Fcitx

See also Fcitx for Fcitx configuration.

Open the configuration dialog of Fcitx by running:

    $ fcitx-configtool

In the Input Method tab, click on the plus sign and choose Mozc from the list in the dialog. Depending on your configuration, you might need to disable the Only Show Current Language option for Mozc to be available. After confirming the dialog, you can activate Mozc as input method using the usual keyboard shortcuts.

### Mozc for Emacs

You can use mozc.el (mozc-mode) to input Japanese via LEIM (Library of Emacs Input Method). To use mozc-mode, write the following 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) which shows a candidate window in box style close to the point. If you want to use it by default, add the following:

    (setq mozc-candidate-style 'overlay)

`C-\` (toggle-input-method) enables and disables use of mozc-mode.

#### Disabling XIM on Emacs

When you are using input method on your desktop and assigning activation/deactivation of input method to C-SPC, you will be not able to use C-SPC/C-@ as set-mark-command on Emacs. To avoid this problem, add the following into your `~/.Xresources` or `~/.Xdefaults`. xim will be disabled on Emacs.

    Emacs*UseXIM: false

## Tips and tricks

### Confirming Mozc version which you are using now

Type "ばーじょん" ("version") and convert it while activating Mozc. The version number of Mozc will be shown in the candidate list like follows:

    ばーじょん

    バージョン
    ヴァージョン
    ばーじょん
    Mozc-1.6.1187.102  ⇐ Current version of Mozc
    ...

### Launching Mozc tools from command line

The followings are commands to launch Mozc tools.

- Mozc Settings: `$ /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_dialog`
- Mozc Hand Writing: `$ /usr/lib/mozc/mozc_tool --mode=hand_writing`
- Mozc Character Palette: `$ /usr/lib/mozc/mozc_tool --mode=character_palette`

Note: If the handwriting window displays an error when attempting to input handwriting, mozc may not have a handwriting module. One possible solution is to install tegaki-models-zinnia-japaneseAUR and re-open the window.

### Use CapsLock as Eisu_toggle key on ASCII layout keyboard

In all of the preset keymap styles of Mozc, the command Toggle alphanumeric mode on Composition mode is assigned to the `Eisu` (Eisu_toggle), `Hiragana/Katakana` or `Muhenkan` key, but the ASCII keyboard has none of them.

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

Warning: This will affect all applications.

Edit `~/.Xmodmap` as follows:

    keycode 66 = Eisu_toggle Caps_Lock
    clear Lock

Then, restart X or run xmodmap to apply the changes immediately:

    $ xmodmap ~/.Xmodmap

## Troubleshooting

### Building Mozc fails (process is killed)

If the build process fails with an error message like the following:

    ...
    /bin/sh: line 1:  xxxx killed
    ...
    make: *** [xxx/xxx...] error 137
    ...

Make sure you have not run out of memory.

### New version of Mozc does not appear though I upgraded Mozc and restarted X or Input Method Framework (not rebooted)

The old version of Mozc may be still on your memory. Try to kill the existing mozc_server process:

    $ killall mozc_server

### mozc_server becomes defunct

Mozc cannot run in root. Start X in normal user.

### mozc_emacs_helper not found in emacs

When installing mozc.el you need to install a helper program called `mozc_emacs_helper`.

You need to install emacs-mozcAUR or emacs-mozc-ut2AUR for this helper program.

Category:

- Input methods