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