chris.bracken.jp

Statically generated site for chris.bracken.jp
git clone https://git.bracken.jp/chris.bracken.jp.git
Log | Files | Refs

index.html (8044B)


      1 <!doctype html>
      2 <html lang="en">
      3 <head>
      4 <meta charset="utf-8">
      5 <meta name="viewport" content="width=device-width, initial-scale=1">
      6 <title>Installing Mozc on Ubuntu - Chris Bracken</title>
      7 <link href="/css/site.css" rel="stylesheet">
      8 <link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
      9 <link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
     10 <link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
     11 <link rel="manifest" href="/favicon/site.webmanifest">
     12 <link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#140f42">
     13 <link rel="shortcut icon" href="/favicon/favicon.ico">
     14 <meta name="msapplication-TileColor" content="#603cba">
     15 <meta name="msapplication-config" content="/favicon/browserconfig.xml">
     16 <meta name="theme-color" content="#ffffff">
     17 </head>
     18 <body>
     19 <header id="header">
     20 <div class="site-title">
     21 <h1><a href="/">Chris Bracken</a></h1>
     22 </div>
     23 
     24 <nav class="site-navbar">
     25 <ul id="menu" class="menu">
     26   <li class="menu-item"><a class="menu-item-a" href="/">Home</a></li>
     27   <li class="menu-item"><a class="menu-item-a" href="/about/">About</a></li>
     28   <li class="menu-item"><a class="menu-item-a" href="/code/">Code</a></li>
     29   <li class="menu-item"><a class="menu-item-a" rel="me"href="https://bsd.network/@cbracken">Fediverse</a></li>
     30 </ul>
     31 </nav>
     32 </header>
     33 <main id="main">
     34 <article>
     35 <h2 class="post-title"><a href="https://chris.bracken.jp/2011/04/installing-mozc-on-ubuntu/">Installing Mozc on Ubuntu</a></h2>
     36 22 April 2011
     37 <p>If you&rsquo;re a Japanese speaker, one of the first things you do when you install a
     38 fresh Linux distribution is to install a decent <a href="https://en.wikipedia.org/wiki/Japanese_IME">Japanese IME</a>.
     39 Ubuntu defaults to <a href="https://sourceforge.jp/projects/anthy/news/">Anthy</a>, but I personally prefer <a href="https://code.google.com/p/mozc/">Mozc</a>, and
     40 that&rsquo;s what I&rsquo;m going to show you how to install here.</p>
     41 <p><em>Update (2011-05-01):</em> Found an older <a href="https://www.youtube.com/watch?v=MfgjTCXZ2-s">video tutorial</a> on YouTube
     42 which provides an alternative (and potentially more comprehensive) solution for
     43 Japanese support on 10.10 using ibus instead of uim, which is the better choice
     44 for newer releases.</p>
     45 <p><em>Update (2011-10-25):</em> The software installation part of this process got a
     46 whole lot easier in Ubuntu releases after Natty, and as noted above, I&rsquo;d
     47 recommend sticking with ibus over uim.</p>
     48 <h3 id="japanese-input-basics">Japanese Input Basics</h3>
     49 <p>Before we get going, let&rsquo;s understand a bit about how Japanese input works on
     50 computers. Japanese comprises three main character sets: the two phonetic
     51 character sets, hiragana and katakana at 50 characters each, plus many
     52 thousands of Kanji, each with multiple readings. Clearly a full keyboard is
     53 impractical, so a mapping is required.</p>
     54 <p>Input happens in two steps. First, you input the text phonetically, then you
     55 convert it to a mix of kanji and kana.</p>
     56 <figure><img src="/post/2011-04-22-henkan.png"
     57     alt="Japanese IME completion menu">
     58 </figure>
     59 
     60 <p>Over the years, two main mechanisms evolved to input kana. The first was common
     61 on old <em>wapuro</em>, and assigns a kana to each key on the keyboard—e.g. where
     62 the <em>A</em> key appears on a QWERTY keyboard, you&rsquo;ll find a ち. This is how our
     63 grandparents hacked out articles for the local <em>shinbun</em>, but I suspect only a
     64 few die-hard traditionalists still do this. The second and more common method
     65 is literal <a href="https://en.wikipedia.org/wiki/Wapuro">transliteration of roman characters into kana</a>. You
     66 type <em>fujisan</em> and out comes ふじさん.</p>
     67 <p>Once the phonetic kana have been input, you execute a conversion step wherein
     68 the input is transformed into the appropriate mix of kanji and kana. Given the
     69 large number of homonyms in Japanese, this step often involves disambiguating
     70 your input by selecting the intended kanji. For example, the <em>mita</em> in <em>eiga wo
     71 mita</em> (I watched a movie) is properly rendered as 観た whereas the <em>mita</em> in
     72 <em>kuruma wo mita</em> (I saw a car) should be 見た, and in neither case is it <em>mita</em>
     73 as in the place name <em>Mita-bashi</em> (Mita bridge) which is written 三田.</p>
     74 <h3 id="some-implementation-details">Some Implementation Details</h3>
     75 <p>Let&rsquo;s look at implementation. There are two main components used in inputting
     76 Japanese text:</p>
     77 <p>The GUI system (e.g. ibus, uim) is responsible for:</p>
     78 <ol>
     79 <li>Maintaining and switching the current input mode:
     80 ローマ字、ひらがな、カタカナ、半額カタカナ.</li>
     81 <li>Transliteration of character input into kana: <em>ku</em> into く,
     82 <em>nekko</em> into ねっこ, <em>xtu</em> into っ.</li>
     83 <li>Managing the text under edit (the underlined stuff) and the
     84 drop-down list of transliterations.</li>
     85 <li>Ancillary functions such as supplying a GUI for custom dictionary
     86 management, kanji lookup by radical, etc.</li>
     87 </ol>
     88 <p>The transliteration engine (e.g. Anthy, Mozc) is responsible for transforming a
     89 piece of input text, usually in kana form, into kanji: for example みる into
     90 one of: 見る、観る、診る、視る. This involves:</p>
     91 <ol>
     92 <li>Breaking the input phrase into components.</li>
     93 <li>Transforming each component into the appropriate best guess based on context
     94 and historical input.</li>
     95 <li>Supplying alternative transformations in case the best guess was incorrect.</li>
     96 </ol>
     97 <h3 id="why-mozc">Why Mozc?</h3>
     98 <p>TL;DR: because it&rsquo;s better. Have a look at the conversion list up at the top of
     99 this post. The input is <em>kinou</em>, for which there are two main conversion
    100 candidates: 機能 (feature) and 昨日 (yesterday). Notice however, that it also
    101 supplies several conversions for yesterday&rsquo;s date in various formats, including
    102 「平成23年4月21日」 using <a href="https://en.wikipedia.org/wiki/Japanese_era_name">Japanese Era Name</a> rather than the
    103 Western notation 2011. This is just one small improvement among dozens of
    104 clever tricks it performs. If you&rsquo;re thinking this bears an uncanny resemblance
    105 to tricks that <a href="https://www.google.com/intl/ja/ime/">Google&rsquo;s Japanese IME</a> supports, you&rsquo;re right: Mozc
    106 originated from the same codebase.</p>
    107 <h3 id="switching-to-mozc">Switching to Mozc</h3>
    108 <p>So let&rsquo;s assume you&rsquo;re now convinced to abandon Anthy and switch to Mozc.
    109 You&rsquo;ll need to make some changes. Here are the steps:</p>
    110 <p>If you haven&rsquo;t yet done so, install some Japanese fonts from either Software
    111 Centre or Synaptic. I&rsquo;d recommend grabbing the <em>ttf-takao</em> package.</p>
    112 <p>Next up, we&rsquo;ll install and configure Mozc.</p>
    113 <ol>
    114 <li><strong>Install ibus-mozc:</strong> <code>sudo apt-get install ibus-mozc</code></li>
    115 <li><strong>Restart the ibus daemon:</strong> <code>/usr/bin/ibus-daemon --xim -r -d</code></li>
    116 <li><strong>Set your input method to mozc:</strong>
    117 <ol>
    118 <li>Open <em>Keyboard Input Methods</em> settings.</li>
    119 <li>Select the <em>Input Method</em> tab.</li>
    120 <li>From the <em>Select an input method</em> drop-down, select Japanese, then mozc from
    121 the sub-menu.</li>
    122 <li>Select <em>Japanese - Anthy</em> from the list, if it appears there, and click
    123 <em>Remove</em>.</li>
    124 </ol>
    125 </li>
    126 <li><strong>Optionally, remove Anthy from your system:</strong> <code>sudo apt-get autoremove anthy</code></li>
    127 </ol>
    128 <p>Log out, and back in. You should see an input method menu in the menu
    129 bar at the top of the screen.</p>
    130 <p>That&rsquo;s it, Mozcを楽しんでください!</p>
    131 </article>
    132 </main>
    133 
    134 <footer id="footer">
    135 <div class="copyright">
    136 <span xmlns:dct="http://purl.org/dc/terms/" xmlns:cc="http://creativecommons.org/ns#">
    137 The content of this site by
    138 <a rel="cc:attributionURL" href="https://chris.bracken.jp/about"><span rel="cc:attributionName">Chris Bracken</span></a>
    139 is
    140 <a href="https://creativecommons.org/licenses/by/4.0">CC BY 4.0</a>.
    141 </span>
    142 </div>
    143 </footer>
    144 </body>
    145 </html>