Difference between revisions of "Mozc"

From ArchWiki
Jump to: navigation, search
 
(General enhancement)
Line 1: Line 1:
==== Mozc ====
+
[[Category:Internationalization]]
[http://code.google.com/p/mozc/ Mozc] (on [https://aur.archlinux.org/packages.php?K=mozc AUR]) is a Japanese open source input method that originates from [http://www.google.com/intl/ja/ime/ 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, [http://code.google.com/p/macuim/ macuim] provides uim-mozc plugin and you can use it with {{AUR|mozc-svn}} or {{AUR|mozc-ut}} on AUR.
+
[[ja:Mozc]]
 +
[http://code.google.com/p/mozc/ Mozc] is a Japanese Input Method Editor (IME) designed for multi-platform such as Chromium OS, Windows, Mac and Linux. This open-source project originates from [http://www.google.com/intl/ja/ime/ Google Japanese Input]. Detailed differences between Mozc and Google Japanese Input are described in [http://code.google.com/p/mozc/wiki/AboutMozc About Mozc] (In short, Mozc does not have equivalent conversion quality to Google Japanese Input).
  
* {{AUR|mozc-svn}}
+
== Installation ==
** 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.}}
+
{{Note|Mozc works with {{Pkg|ibus}}. Please see also [[IBus]] for installation and configuration.}}
* {{AUR|mozc-ut}}
+
Mozc is available on [https://aur.archlinux.org/packages.php?K=mozc&SeB=x AUR]. This package consists as follows:
** mozc-ut comes with [http://www.geocities.jp/ep3797/mozc_01.html 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:
+
 
{| class="wikitable" style="text-align:center;margin:0 2em auto"
 
{| class="wikitable" style="text-align:center;margin:0 2em auto"
!Package !! mozc !! mozc-svn !! mozc-ut !! description
+
!Package !! mozc !! description
 
|-
 
|-
 
!Group
 
!Group
| mozc-im || mozc-im-svn || mozc-im-ut ||
+
| mozc-im ||  
 
|-
 
|-
!rowspan="5" | Component
+
!rowspan="3" | Component
| mozc || mozc-svn || mozc-ut || Server part of the Mozc
+
| mozc || Server part of the Mozc
 
|-
 
|-
| ibus-mozc || ibus-mozc-svn || ibus-mozc-ut || IBus engine module (optional)
+
| ibus-mozc || IBus engine module
 
|-
 
|-
| <small>''N/A''</small> || uim-mozc-svn || uim-mozc-ut || uim plugin module (optional)
+
| emacs-mozc || Mozc for Emacs (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)
+
 
|}
 
|}
  
===== Using Unofficial user repository =====
+
=== Using Unofficial user repository ===
There is an unofficial user repository of Mozc. Add the following into /etc/pacman.conf.
+
There is an unofficial user repository of Mozc. Add the following into your /etc/pacman.conf.
 
  [pnsft-pur]
 
  [pnsft-pur]
 
  Server = http://downloads.sourceforge.net/project/pnsft-aur/pur/$arch
 
  Server = http://downloads.sourceforge.net/project/pnsft-aur/pur/$arch
{{Note|This repo provides x86_64 packages only.}}
+
{{Note|This repo provides x86_64 packages only now.}}
You can choose install packages of Mozc as follows:
+
You can choose install packages specifying group name as follows:
  # pacman -S mozc-im (Or mozc-im-svn / mozc-im-ut)
+
  # pacman -S mozc-im
 
Or, specify package names directly. For example:
 
Or, specify package names directly. For example:
  # pacman -S uim-mozc-svn emacs-mozc-svn
+
  # pacman -S mozc ibus-mozc emacs-mozc
  
===== Compiling Mozc for uim using PKGBUILD =====
+
=== Compiling Mozc using PKGBUILD ===
====== Prepare building Mozc ======
+
==== Prepare building Mozc ====
 
Mozc requires the following packages to be built in addition to its depending packages:
 
Mozc requires the following packages to be built in addition to its depending packages:
*Common
+
*{{Pkg|pkg-config}}
**{{Pkg|pkg-config}}
+
*{{Pkg|python2}}
**{{Pkg|python2}}
+
*{{AUR|zinnia}} ''(AUR)''
**{{AUR|zinnia}} ''(AUR)''
+
*mozc-svn
+
**{{Pkg|subversion}}
+
*mozc-ut
+
**{{Pkg|ruby}}
+
 
Install {{AUR|zinnia}} from [[AUR]] before building Mozc.
 
Install {{AUR|zinnia}} from [[AUR]] before building Mozc.
  
====== Edit PKGBUILD ======
+
==== Edit PKGBUILD ====
First, you get {{AUR|mozc-svn}} or {{AUR|mozc-ut}} tarball from the AUR and edit the PKGBUILD to enable uim-mozc. That is, uncomment {{Ic|_uim_mozc}} line and you can comment out {{Ic|_ibus_mozc}} line to disable ibus module if unnecessary:
+
First, you get {{AUR|mozc}} tarball from AUR and edit the PKGBUILD if necessary.
  ## You can choose the input method framework to use either ibus, uim or both.
+
  $ wget https://aur.archlinux.org/packages/mo/mozc/mozc.tar.gz
  ## If you will be not using ibus, comment out below.
+
  $ tar xvf mozc.tar.gz
  #_ibus_mozc="yes"
+
  $ cd mozc
## If you will be using uim, uncomment below.
+
 
_uim_mozc="yes"
+
If you will be using mozc.el on Emacs, uncomment {{Ic|_emacs_mozc}} line.
If you will be using mozc.el on Emacs instead of uim.el, uncomment {{Ic|_emacs_mozc}} line.
+
 
  ## If you will be using mozc.el on Emacs, uncomment below.
 
  ## If you will be using mozc.el on Emacs, uncomment below.
 
  _emacs_mozc="yes"
 
  _emacs_mozc="yes"
  
====== Build and install ======
+
==== Build and install ====
Finally, build and install:
+
Then, build and install:
 
  $ makepkg -s -i
 
  $ makepkg -s -i
  
===== Re-register Mozc on uim =====
+
=== Make available Mozc ===
You '''must''' run the following command whenever you upgrade or (re-)install uim.
+
Restart X or IBus to enable use of Mozc.
# uim-module-manager --register mozc
+
  
===== Tips =====
+
== Configuration ==
====== Launching Mozc tools from commandline ======
+
''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 {{Keypress|Alt + Shift_L}} (by IBus default).
 +
 
 +
=== 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 {{Ic|.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 overlay mode, add the following:
 +
(setq mozc-candidate-style 'overlay)
 +
 
 +
{{Ic|C-\}} (`toggle-input-method') enable/disable 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 {{Ic|~/.Xresources}} or {{Ic|~/.Xdefaults}}. xim will be disabled on Emacs.
 +
Emacs*UseXIM: false
 +
 
 +
== Tips ==
 +
=== Confirming Mozc version which you are using now ===
 +
Type "ばーじょん" and convert it while activating Mozc. The version number of Mozc will be shown in the candidate list like follows:
 +
{{Hc|<u>ばーじょん</u>
 +
|バージョン
 +
ヴァージョン
 +
ばーじょん
 +
Mozc-1.6.1187.102  ''⇐ Current version of Mozc''
 +
...}}
 +
 
 +
=== Launching Mozc tools from command line ===
 
The followings are commands to launch mozc tools.
 
The followings are commands to launch mozc tools.
 
* Mozc property:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=config_dialog}}
 
* Mozc property:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=config_dialog}}
 
* Mozc Dictionary Tool:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=dictionary_tool}}
 
* Mozc Dictionary Tool:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=dictionary_tool}}
* Mozc word register:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=word_register}}
+
* Mozc Word Register:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=word_register}}
* Mozc hand writing tool:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=hand_writing}}
+
* Mozc Hand Writing:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=hand_writing}}
* Mozc character palette:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=character_palette}}
+
* Mozc Character Palette:{{bc|1=$ /usr/lib/mozc/mozc_tool --mode=character_palette}}
  
====== Use CapsLock as Eisu_toggle key on ASCII layout keyboard ======
+
=== 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.
+
All of the preset keymap styles of Mozc, command 'ToggleAlphanumericMode' on 'Composition' mode is assigned to {{Keypress|Eisu}} (Eisu_toggle), {{Keypress|Hiragana}}/{{Keypress|Katakana}} or {{Keypress|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.
+
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 {{Keypress|CapsLock}} (without any modifier keys) and the Caps_Lock to {{Keypress|Shift + CapsLock}}, like OADG keyboard layout.
 
{{Warning|This way affects to desktop wide.}}
 
{{Warning|This way affects to desktop wide.}}
  
Line 90: Line 108:
 
{{bc|$ xmodmap ~/.Xmodmap}}
 
{{bc|$ xmodmap ~/.Xmodmap}}
  
==== Using mozc.el ====
+
== Troubleshooting ==
If you use Mozc, you can use mozc.el. Write the following settings into your {{Ic|.emacs.d/init.el}} or some other file for Emacs customizing.
+
=== Building Mozc fails (process is killed) ===
(require 'mozc) ; or (load-file "/path/to/mozc.el")
+
If build process is failed with like the following messages:
(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.
+
/bin/sh: line 1:  xxxx killed
(setq mozc-candidate-style 'overlay)
+
...
 +
make: *** [xxx/xxx...] error 137
 +
...
 +
Make sure whether you did 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 process:
 +
$ killall mozc_server
 +
 
 +
== Mozc variants on AUR ==
 +
Though {{AUR|Mozc}} adapts to only ibus input method framework, [http://code.google.com/p/macuim/ macuim] provides uim-mozc plugin which can use with {{AUR|mozc-svn}} or {{AUR|mozc-ut}}, and [[Fcitx]] also provides fcitx-mozc plugin which can use with {{AUR|mozc-fcitx}} or mozc-svn.
 +
 
 +
;mozc-svn
 +
:{{AUR|mozc-svn}} builds with the published svn repository instead of source tarball and can build uim-mozc and fcitx-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-ut
 +
:{{AUR|mozc-ut}} comes with [http://www.geocities.jp/ep3797/mozc_01.html Mozc UT dictionary] and can build uim-mozc/fcitx-mozc. The dictionary adds over 350,000 words into original.{{Note|Building mozc-ut requires further long time to generate dictionary seed.}}
 +
;mozc-fcitx
 +
:{{AUR|mozc-fcitx}} is Mozc package dedicated to [[Fcitx]].
 +
 
 +
Each packages consist as follows:
 +
{| class="wikitable" style="text-align:center;margin:0 2em auto"
 +
!Package !! mozc !! mozc-svn !! mozc-ut !! mozc-fcitx !! description
 +
|-
 +
!Group
 +
| mozc-im || mozc-im-svn || mozc-im-ut || 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)
 +
|-
 +
| <small>''N/A''</small> || 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)
 +
|-
 +
| -- || -- || -- || mozc-fcitx || mozc-fcitx package (all in one)
 +
|}
 +
 
 +
== Useful literature ==
 +
*[http://code.google.com/p/mozc/ Mozc official site]

Revision as of 09:47, 28 September 2012

Mozc is a Japanese Input Method Editor (IME) designed for multi-platform such as Chromium OS, Windows, Mac and Linux. This open-source project originates from Google Japanese Input. Detailed differences between Mozc and Google Japanese Input are described in About Mozc (In short, Mozc does not have equivalent conversion quality to Google Japanese Input).

Installation

Note: Mozc works with ibus. Please see also IBus for installation and configuration.

Mozc is available on AUR. This package consists as follows:

Package mozc description
Group mozc-im
Component mozc Server part of the Mozc
ibus-mozc IBus engine module
emacs-mozc Mozc for Emacs (optional)

Using Unofficial user repository

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

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

You can choose install packages specifying group name as follows:

# pacman -S mozc-im

Or, specify package names directly. For example:

# pacman -S mozc ibus-mozc emacs-mozc

Compiling Mozc 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 mozcAUR 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 _emacs_mozc line.

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

Build and install

Then, build and install:

$ makepkg -s -i

Make available Mozc

Restart X or IBus to enable use of Mozc.

Configuration

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 Template:Keypress (by IBus default).

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 overlay mode, add the following:

(setq mozc-candidate-style 'overlay)

C-\ (`toggle-input-method') enable/disable 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 "ばーじょん" 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
  • 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 Template:Keypress (Eisu_toggle), Template:Keypress/Template:Keypress or Template:Keypress 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 Template:Keypress (without any modifier keys) and the Caps_Lock to Template:Keypress, 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 did 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 process:

$ killall mozc_server

Mozc variants on AUR

Though MozcAUR adapts to only ibus input method framework, macuim provides uim-mozc plugin which can use with mozc-svnAUR or mozc-utAUR, and Fcitx also provides fcitx-mozc plugin which can use with mozc-fcitxAUR or mozc-svn.

mozc-svn
mozc-svnAUR builds with the published svn repository instead of source tarball and can build uim-mozc and fcitx-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-ut
mozc-utAUR comes with Mozc UT dictionary and can build uim-mozc/fcitx-mozc. The dictionary adds over 350,000 words into original.
Note: Building mozc-ut requires further long time to generate dictionary seed.
mozc-fcitx
mozc-fcitxAUR is Mozc package dedicated to Fcitx.

Each packages consist as follows:

Package mozc mozc-svn mozc-ut mozc-fcitx description
Group mozc-im mozc-im-svn mozc-im-ut mozc-im
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)
-- -- -- mozc-fcitx mozc-fcitx package (all in one)

Useful literature