index.xml (8115B)
1 <?xml version="1.0" encoding="utf-8" standalone="yes"?> 2 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 3 <channel> 4 <title>Linux on Chris Bracken</title> 5 <link>https://chris.bracken.jp/tags/linux/</link> 6 <description>Recent content in Linux on Chris Bracken</description> 7 <generator>Hugo -- gohugo.io</generator> 8 <language>en</language> 9 <lastBuildDate>Fri, 22 Apr 2011 00:00:00 +0000</lastBuildDate><atom:link href="https://chris.bracken.jp/tags/linux/index.xml" rel="self" type="application/rss+xml" /> 10 <item> 11 <title>Installing Mozc on Ubuntu</title> 12 <link>https://chris.bracken.jp/2011/04/installing-mozc-on-ubuntu/</link> 13 <pubDate>Fri, 22 Apr 2011 00:00:00 +0000</pubDate> 14 15 <guid>https://chris.bracken.jp/2011/04/installing-mozc-on-ubuntu/</guid> 16 <description><p>If you&rsquo;re a Japanese speaker, one of the first things you do when you install a 17 fresh Linux distribution is to install a decent <a href="https://en.wikipedia.org/wiki/Japanese_IME">Japanese IME</a>. 18 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 19 that&rsquo;s what I&rsquo;m going to show you how to install here.</p> 20 <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 21 which provides an alternative (and potentially more comprehensive) solution for 22 Japanese support on 10.10 using ibus instead of uim, which is the better choice 23 for newer releases.</p> 24 <p><em>Update (2011-10-25):</em> The software installation part of this process got a 25 whole lot easier in Ubuntu releases after Natty, and as noted above, I&rsquo;d 26 recommend sticking with ibus over uim.</p> 27 <h3 id="japanese-input-basics">Japanese Input Basics</h3> 28 <p>Before we get going, let&rsquo;s understand a bit about how Japanese input works on 29 computers. Japanese comprises three main character sets: the two phonetic 30 character sets, hiragana and katakana at 50 characters each, plus many 31 thousands of Kanji, each with multiple readings. Clearly a full keyboard is 32 impractical, so a mapping is required.</p> 33 <p>Input happens in two steps. First, you input the text phonetically, then you 34 convert it to a mix of kanji and kana.</p> 35 <figure><img src="https://chris.bracken.jp/post/2011-04-22-henkan.png" 36 alt="Japanese IME completion menu"> 37 </figure> 38 39 <p>Over the years, two main mechanisms evolved to input kana. The first was common 40 on old <em>wapuro</em>, and assigns a kana to each key on the keyboard—e.g. where 41 the <em>A</em> key appears on a QWERTY keyboard, you&rsquo;ll find a ち. This is how our 42 grandparents hacked out articles for the local <em>shinbun</em>, but I suspect only a 43 few die-hard traditionalists still do this. The second and more common method 44 is literal <a href="https://en.wikipedia.org/wiki/Wapuro">transliteration of roman characters into kana</a>. You 45 type <em>fujisan</em> and out comes ふじさん.</p> 46 <p>Once the phonetic kana have been input, you execute a conversion step wherein 47 the input is transformed into the appropriate mix of kanji and kana. Given the 48 large number of homonyms in Japanese, this step often involves disambiguating 49 your input by selecting the intended kanji. For example, the <em>mita</em> in <em>eiga wo 50 mita</em> (I watched a movie) is properly rendered as 観た whereas the <em>mita</em> in 51 <em>kuruma wo mita</em> (I saw a car) should be 見た, and in neither case is it <em>mita</em> 52 as in the place name <em>Mita-bashi</em> (Mita bridge) which is written 三田.</p> 53 <h3 id="some-implementation-details">Some Implementation Details</h3> 54 <p>Let&rsquo;s look at implementation. There are two main components used in inputting 55 Japanese text:</p> 56 <p>The GUI system (e.g. ibus, uim) is responsible for:</p> 57 <ol> 58 <li>Maintaining and switching the current input mode: 59 ローマ字、ひらがな、カタカナ、半額カタカナ.</li> 60 <li>Transliteration of character input into kana: <em>ku</em> into く, 61 <em>nekko</em> into ねっこ, <em>xtu</em> into っ.</li> 62 <li>Managing the text under edit (the underlined stuff) and the 63 drop-down list of transliterations.</li> 64 <li>Ancillary functions such as supplying a GUI for custom dictionary 65 management, kanji lookup by radical, etc.</li> 66 </ol> 67 <p>The transliteration engine (e.g. Anthy, Mozc) is responsible for transforming a 68 piece of input text, usually in kana form, into kanji: for example みる into 69 one of: 見る、観る、診る、視る. This involves:</p> 70 <ol> 71 <li>Breaking the input phrase into components.</li> 72 <li>Transforming each component into the appropriate best guess based on context 73 and historical input.</li> 74 <li>Supplying alternative transformations in case the best guess was incorrect.</li> 75 </ol> 76 <h3 id="why-mozc">Why Mozc?</h3> 77 <p>TL;DR: because it&rsquo;s better. Have a look at the conversion list up at the top of 78 this post. The input is <em>kinou</em>, for which there are two main conversion 79 candidates: 機能 (feature) and 昨日 (yesterday). Notice however, that it also 80 supplies several conversions for yesterday&rsquo;s date in various formats, including 81 「平成23年4月21日」 using <a href="https://en.wikipedia.org/wiki/Japanese_era_name">Japanese Era Name</a> rather than the 82 Western notation 2011. This is just one small improvement among dozens of 83 clever tricks it performs. If you&rsquo;re thinking this bears an uncanny resemblance 84 to tricks that <a href="https://www.google.com/intl/ja/ime/">Google&rsquo;s Japanese IME</a> supports, you&rsquo;re right: Mozc 85 originated from the same codebase.</p> 86 <h3 id="switching-to-mozc">Switching to Mozc</h3> 87 <p>So let&rsquo;s assume you&rsquo;re now convinced to abandon Anthy and switch to Mozc. 88 You&rsquo;ll need to make some changes. Here are the steps:</p> 89 <p>If you haven&rsquo;t yet done so, install some Japanese fonts from either Software 90 Centre or Synaptic. I&rsquo;d recommend grabbing the <em>ttf-takao</em> package.</p> 91 <p>Next up, we&rsquo;ll install and configure Mozc.</p> 92 <ol> 93 <li><strong>Install ibus-mozc:</strong> <code>sudo apt-get install ibus-mozc</code></li> 94 <li><strong>Restart the ibus daemon:</strong> <code>/usr/bin/ibus-daemon --xim -r -d</code></li> 95 <li><strong>Set your input method to mozc:</strong> 96 <ol> 97 <li>Open <em>Keyboard Input Methods</em> settings.</li> 98 <li>Select the <em>Input Method</em> tab.</li> 99 <li>From the <em>Select an input method</em> drop-down, select Japanese, then mozc from 100 the sub-menu.</li> 101 <li>Select <em>Japanese - Anthy</em> from the list, if it appears there, and click 102 <em>Remove</em>.</li> 103 </ol> 104 </li> 105 <li><strong>Optionally, remove Anthy from your system:</strong> <code>sudo apt-get autoremove anthy</code></li> 106 </ol> 107 <p>Log out, and back in. You should see an input method menu in the menu 108 bar at the top of the screen.</p> 109 <p>That&rsquo;s it, Mozcを楽しんでください!</p> 110 </description> 111 </item> 112 113 </channel> 114 </rss>