Difference between revisions of "Mozc"

From ArchWiki
Jump to: navigation, search
(Update introduction from the GitHub repo (which has now become the official “home page”) since the previous excerpt contained a dead link (About Mozc))
(Installation: Compress the Installation section. Many subsections were outdated (mozc-svn due to GitHub migration, mozc-ut since the package is no longer available), redundant (uim-mozc), or just didn’t deserve an own heading (Make available Mozc))
Line 7: Line 7:
 
== Installation ==
 
== Installation ==
  
You can install {{AUR|mozc}} (vanilla) using [[#Unofficial user repository|unofficial user repository]] or build yourself from [[AUR]].
+
Depending on your target setup, there are several available Mozc packages to choose from. Firstly, you will likely need to install both the Mozc core package and an integration for the Input Method Framework of your choice (such as [[Fcitx]], [[IBus]], or [[UIM|uim]]), though some Fcitx packages come bundled with the core. Secondly, there exist some unofficial dictionaries: The UT (discontinued) and UT2 dictionaries, which are combined from several sources with hit numbers coming from Google/Yahoo and Wikipedia, respectively, and the NEologd UT dictionary based on the mecab-ipadic-NEologd Neologism dictionary.
  
{{Note|Mozc works with {{Pkg|ibus}}. Please see also [[IBus]] for installation and configuration.}}
+
The following table shows the packages corresponding to certain combinations of the components and dictionaries; merged cells with multiple package names indicate split packages.
This package consists as follows:
+
 
{| class="wikitable" style="text-align:center;margin:0 2em auto"
+
{| class="wikitable"
!Package !! mozc !! description
+
! !! Vanilla !! UT !! UT2 !! NEologd UT
 
|-
 
|-
!Group
+
! Fcitx integration
| mozc-im ||  
+
| rowspan="2" | {{Pkg|fcitx-mozc}}
 +
| rowspan="3" | {{AUR|fcitx-mozc-ut}}
 +
| rowspan="2" | {{AUR|fcitx-mozc-ut2}}
 +
| rowspan="3" | {{AUR|fcitx-mozc-neologd-ut}}<br />{{AUR|mozc-neologd-ut}}
 
|-
 
|-
!rowspan="3" | Component
+
! rowspan="2" | Mozc core
| mozc || Server part of the Mozc
 
 
|-
 
|-
| ibus-mozc || IBus engine module
+
| rowspan="3" | {{AUR|mozc}}<br />{{AUR|ibus-mozc}}<br />{{AUR|emacs-mozc}}
 +
| rowspan="4" | {{AUR|mozc-ut2}}<br />{{AUR|ibus-mozc-ut2}}<br />{{AUR|emacs-mozc-ut2}}<br />{{AUR|uim-mozc-ut2}}
 
|-
 
|-
| emacs-mozc || Mozc for Emacs (optional)
+
! IBus integration
 +
| ||
 +
|-
 +
! Emacs integration
 +
| ||
 +
|-
 +
! uim integration
 +
| {{AUR|uim-mozc}} || ||
 
|}
 
|}
  
{{Tip|[[#Variants on AUR|Unofficial plugins for the other IM frameworks are available]]}}
+
Some of the above packages also contain definitions at the top of their respective PKGBUILDs that can be altered to (de)activate certain features. Most notably, to build the emacs packages the {{ic|_emacs_mozc}} line must be uncommented:
 +
## If you will be using mozc.el on Emacs, uncomment below.
 +
_emacs_mozc="yes"
 +
Likewise, uim-mozc-ut2 must also be enabled manually.
 +
 
 +
Once Mozc is installed, it might be necessary to restart X or the Input Method Framework before it can be used.
  
 
=== Unofficial user repository ===
 
=== Unofficial user repository ===
  
There is an unofficial user repository of Mozc. Add the following into your {{ic|/etc/pacman.conf}}:
+
Some Mozc packages are also available from an unofficial user repository. Add the following into your {{ic|/etc/pacman.conf}}:
 
{{bc|<nowiki>
 
{{bc|<nowiki>
 
[pnsft-pur]
 
[pnsft-pur]
Line 36: Line 51:
 
</nowiki>}}
 
</nowiki>}}
 
{{Note|This repo provides x86_64 packages only now.}}
 
{{Note|This repo provides x86_64 packages only now.}}
And refresh package database.
+
And refresh the package database.
You can choose to install packages specifying group name as follows:
+
You can choose to install packages specifying the group name mozc-im as follows:
 
  # pacman -S mozc-im
 
  # pacman -S mozc-im
 
Or, specify package names directly. For example:
 
Or, specify package names directly. For example:
 
  # pacman -S mozc ibus-mozc emacs-mozc
 
  # pacman -S mozc ibus-mozc emacs-mozc
 
=== Using PKGBUILD ===
 
 
You can install from AUR as follows.
 
 
First, get {{AUR|mozc}} tarball from AUR and edit the PKGBUILD if necessary.
 
$ wget https://aur.archlinux.org/packages/mo/mozc/mozc.tar.gz
 
$ tar xvf mozc.tar.gz
 
$ cd mozc
 
 
If you will be using mozc.el on Emacs, uncomment {{ic|_emacs_mozc}} line.
 
## If you will be using mozc.el on Emacs, uncomment below.
 
_emacs_mozc="yes"
 
 
=== Using fcitx ===
 
{{Pkg|fcitx-mozc}} is the all in one Mozc package available in [[Official repositories|offical repository]], dedicated to [[fcitx]].
 
 
=== Make available Mozc  ===
 
 
Restart X or IBus to enable use of Mozc.
 
 
=== Variants on AUR ===
 
 
Each packages consist as follows:
 
{| class="wikitable" style="text-align:center;margin:0 2em auto"
 
!Package !! mozc !! mozc-svn !! mozc-ut !! description
 
|-
 
!Group
 
| mozc-im || mozc-im-svn || mozc-im ||
 
|-
 
!rowspan="6" | Component
 
| mozc || mozc-svn || mozc-ut ||Server part of the Mozc
 
|-
 
| ibus-mozc || ibus-mozc-svn || ibus-mozc-ut || IBus engine module (optional)
 
|-
 
| (uim-mozc) || uim-mozc-svn || uim-mozc-ut || uim plugin module (optional)
 
|-
 
| <small>''N/A''</small> || fcitx-mozc-svn || <small>''N/A''</small> || Fcitx module (optional)
 
|-
 
| emacs-mozc || emacs-mozc-svn || emacs-mozc-ut || Mozc for Emacs (optional)
 
|-
 
|}
 
 
==== uim-mozc ====
 
 
Though {{AUR|mozc}} adapts to only IBus input method framework, [http://code.google.com/p/macuim/ macuim] provides ''uim-mozc'' plugin. {{AUR|uim-mozc}} is for vanilla ''mozc'' and {{AUR|mozc-ut}}{{Broken package link|package not found}}, {{AUR|mozc-svn}}{{Broken package link|{{aur-mirror|mozc-svn}}}} can build ''uim-mozc'' itself (see [[Input Japanese using uim]]). You can install ''uim-mozc'' from [[#Unofficial user repository|unofficial user repository]] as well as vanilla ''mozc''.
 
 
==== mozc-ut ====
 
 
{{AUR|mozc-ut}}{{Broken package link|package not found}} comes with [http://www.geocities.jp/ep3797/mozc_01.html Mozc UT dictionary] and can build ''uim-mozc''. The dictionary adds over 350,000 words into original.
 
{{Note|
 
* Building ''mozc-ut'' requires long time to generate dictionary seed.
 
* ''mozc-ut'' can work with ''ibus-mozc'', ''emacs-mozc'' and ''uim-mozc'' of vanilla ''mozc''. That is, you don't have to build such as modules of ''mozc-ut'' by the use of [[#Unofficial user repository|unofficial user repository]].
 
}}
 
 
To build uim-mozc, edit PKGBUILD like follow, i,e. uncomment {{Ic|1=_uim_mozc=}} line:
 
## 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 applying patch for uim-mozc fails, try to uncomment below.
 
#_kill_kill_line="yes"
 
## This will disable the 'kill-line' function of uim-mozc.
 
 
{{Tip|If you will never be using ibus-mozc, comment out the {{Ic|1=_ibus_mozc=}} line.}}
 
 
==== mozc-svn ====
 
 
{{AUR|mozc-svn}}{{Broken package link|{{aur-mirror|mozc-svn}}}} builds using the head of published svn repository and can build ''uim-mozc'' and ''fcitx-mozc'' plugin. You should not use ''mozc-svn'' unless you have any reason (e.g. for test).
 
  
 
== Configuration ==
 
== Configuration ==

Revision as of 03:27, 25 April 2017

From the project 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. […] Detailed differences between Google Japanese Input and Mozc are described in About Branding.

(In short, Mozc does not have equivalent conversion quality to Google Japanese Input).

Installation

Depending on your target setup, there are several available Mozc packages to choose from. Firstly, you will likely need to install both the Mozc core package and an integration for the Input Method Framework of your choice (such as Fcitx, IBus, or uim), though some Fcitx packages come bundled with the core. Secondly, there exist some unofficial dictionaries: The UT (discontinued) and UT2 dictionaries, which are combined from several sources with hit numbers coming from Google/Yahoo and Wikipedia, respectively, and the NEologd UT dictionary based on the mecab-ipadic-NEologd Neologism dictionary.

The following table shows the packages corresponding to certain combinations of the components and dictionaries; merged cells with multiple package names indicate split packages.

Vanilla UT UT2 NEologd UT
Fcitx integration fcitx-mozc fcitx-mozc-utAUR fcitx-mozc-ut2AUR fcitx-mozc-neologd-utAUR
mozc-neologd-utAUR
Mozc core
mozcAUR
ibus-mozcAUR
emacs-mozcAUR
mozc-ut2AUR
ibus-mozc-ut2AUR
emacs-mozc-ut2AUR
uim-mozc-ut2AUR
IBus integration
Emacs integration
uim integration uim-mozcAUR

Some of the above packages also contain definitions at the top of their respective PKGBUILDs that can be altered to (de)activate certain features. Most notably, to build the emacs packages the _emacs_mozc line must be uncommented:

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

Likewise, uim-mozc-ut2 must also be enabled manually.

Once Mozc is installed, it might be necessary to restart X or the Input Method Framework before it can be used.

Unofficial user repository

Some Mozc packages are also available from an unofficial user repository. Add the following into your /etc/pacman.conf:

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

And refresh the package database. You can choose to install packages specifying the group name mozc-im as follows:

# pacman -S mozc-im

Or, specify package names directly. For example:

# pacman -S mozc ibus-mozc emacs-mozc

Configuration

IBus

See also IBus for IBus configuration.

If you use Mozc by default, set it 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 (by IBus default).

uim

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

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

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 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_dialog
  • Mozc Hand Writing: $ /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

All 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 as of r124). 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

Troubleshooting

Building Mozc fails (process is killed)

If build process is failed with like the following messages:

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

Make sure whether you have run out of memory.

New version of Mozc does not appear though I upgraded Mozc and restarted X or IBus (not rebooted)

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

$ killall mozc_server