1
# -*- coding: utf-8 -*-
4
# Copyright 2011 Hiroshi Miura <miurahr@linux.com>
7
# * KAKASI (Kanji Kana Simple inversion program)
8
# * $Id: jj2.c,v 1.7 2001-04-12 05:57:34 rug Exp $
10
# * Hironobu Takahashi (takahasi@tiny.or.jp)
12
# * This program is free software; you can redistribute it and/or modify
13
# * it under the terms of the GNU General Public License as published by
14
# * the Free Software Foundation; either versions 2, or (at your option)
15
# * any later version.
17
# * This program is distributed in the hope that it will be useful
18
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
# * GNU General Public License for more details.
22
# * You should have received a copy of the GNU General Public License
23
# * along with KAKASI, see the file COPYING. If not, write to the Free
24
# * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
28
from calibre.ebooks.unihandecode.pykakasi.j2h import J2H
29
from calibre.ebooks.unihandecode.pykakasi.h2a import H2a
30
from calibre.ebooks.unihandecode.pykakasi.k2a import K2a
51
if self.j2h.isKanji(text[i]):
52
(t, l) = self.j2h.convert(text[i:])
54
otext = otext + text[i]
63
(s, n) = self.h2a.convert(t[m:])
69
otext = otext + tmptext.capitalize()
71
otext = otext + tmptext.capitalize() +' '
72
elif self.h2a.isHiragana(text[i]):
75
(t, l) = self.h2a.convert(text[i:])
79
otext = otext + tmptext
81
elif not self.h2a.isHiragana(text[i]):
82
otext = otext + tmptext + ' '
84
elif self.k2a.isKatakana(text[i]):
87
(t, l) = self.k2a.convert(text[i:])
91
otext = otext + tmptext
93
elif not self.k2a.isKatakana(text[i]):
94
otext = otext + tmptext + ' '
97
otext = otext + text[i]