title: Is there any way to do "logical" transformations between Japanese kana characters with different diacritical marks?
body: <p>In Japanese, there are combining diacritical marks that apply to certain <em>kana</em>, so there is a logical relationship between say "か" (<em>ka</em>) and "が" (<em>ga</em>) - the <em>ga</em> character is voiced.</p>
  
  <p>I'm wondering if there is any natural way (in Python, preferably, though a generalized answer about unicode is fine, too) to do the equivalent of transforming voiced characters to their unvoiced equivalents, and vice-versa - something akin to the <code>lower()</code> method that applies in latin scripts. An example of what I'm looking to do:</p>
  
  <pre><code>&gt;&gt;&gt; devoice('が')
  "か"
  &gt;&gt;&gt; voice('か')
  "が"
  &gt;&gt;&gt; devoice('か')
  "か"
  &gt;&gt;&gt; semivoice('は')
  "ぱ"
  &gt;&gt;&gt; devoice('ぱ')
  "は"
  </code></pre>
  
  <p>At the moment, the best approach I seem to be able to come up with is to generate a lookup table indexed by row, column and voicing, then look up the character I have and translate it in the right direction. That said, I'd like to know if there's a more natural way to do it.</p>
  
  <p>One potential pitfall is that it seems to me that the unicode combining characters do not seem to compare equal to their single-codepoint equivalents:</p>
  
  <pre><code>&gt;&gt;&gt; a = chr(0x304B) + chr(0x3099)
  &gt;&gt;&gt; b = chr(0x304C)
  &gt;&gt;&gt; print(a)
  'が'
  &gt;&gt;&gt; print(b)
  'が'
  &gt;&gt;&gt; a == b
  False
  </code></pre>
  
  <p>I am mainly concerned with the ones that do <em>not</em> involve combining diacriticals, since it seems easy enough to detect and strip off the combining marks.</p>
  
  <p><em>Note:</em> I am not sure I understand Japanese phonology well enough to know what the correct behavior is for <code>う</code> (u) and <code>ゔ</code> (vu - rare / obsolete), which again is why it would be nice if there were a "natural" way to do this.</p>