summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHideaki ABE <abe.sendai@gmail.com>2009-06-02 22:41:51 +0900
committerHideaki ABE <abe.sendai@gmail.com>2009-06-02 22:41:51 +0900
commit24f6a22f403f0dd446cdc3e2e1ba938e60e0cda2 (patch)
treecd15bd6443c959640838062bbc6b75a31b85d6a4
parentb2caa17074633dbe221db5e049a364e8c02163aa (diff)
downloadibus-anthy-24f6a22f403f0dd446cdc3e2e1ba938e60e0cda2.tar.gz
Replaced romaji_correction_rule.get method by romaji_correction_rule_get function.
-rw-r--r--engine/romaji.py15
-rw-r--r--engine/tables.py2
2 files changed, 12 insertions, 5 deletions
diff --git a/engine/romaji.py b/engine/romaji.py
index 34a1dde..80010cd 100644
--- a/engine/romaji.py
+++ b/engine/romaji.py
@@ -23,6 +23,9 @@ from ibus import unichar_half_to_full
from tables import *
import segment
+def romaji_correction_rule_get(k, d):
+ return (u'ん', k[1:2]) if k[0:1] == u'n' and not k[1:2] in u"aiueony'" else d
+
class RomajiSegment(segment.Segment):
def __init__(self, enchars=u"", jachars=u""):
if not jachars:
@@ -56,7 +59,8 @@ class RomajiSegment(segment.Segment):
self._jachars = jachars
return [RomajiSegment(c)]
- jachars, c = romaji_correction_rule.get(text, (None, None))
+# jachars, c = romaji_correction_rule.get(text, (None, None))
+ jachars, c = romaji_correction_rule_get(text, (None, None))
if jachars:
self._enchars = text[0]
self._jachars = jachars
@@ -81,7 +85,8 @@ class RomajiSegment(segment.Segment):
return [jasegment, RomajiSegment(c)]
return [jasegment]
- jachars, c = romaji_correction_rule.get(enchars, (None, None))
+# jachars, c = romaji_correction_rule.get(enchars, (None, None))
+ jachars, c = romaji_correction_rule_get(enchars, (None, None))
if jachars:
jasegment = RomajiSegment(enchars[:-len(c)], jachars)
self._enchars = text[:i]
@@ -113,7 +118,8 @@ class RomajiSegment(segment.Segment):
self._enchars = c
return [RomajiSegment(text[0], jachars)]
- jachars, c = romaji_correction_rule.get(text, (None, None))
+# jachars, c = romaji_correction_rule.get(text, (None, None))
+ jachars, c = romaji_correction_rule_get(text, (None, None))
if jachars:
self._enchars = c
return [RomajiSegment(text[0], jachars)]
@@ -134,7 +140,8 @@ class RomajiSegment(segment.Segment):
self._enchars = c + text[i:]
return [RomajiSegment(enchars[:-len(c)], jachars)]
- jachars, c = romaji_correction_rule.get(enchars, (None, None))
+# jachars, c = romaji_correction_rule.get(enchars, (None, None))
+ jachars, c = romaji_correction_rule_get(enchars, (None, None))
if jachars:
self._enchars = c + text[i:]
return [RomajiSegment(enchars[:-len(c)], jachars)]
diff --git a/engine/tables.py b/engine/tables.py
index 107a4e9..a59306e 100644
--- a/engine/tables.py
+++ b/engine/tables.py
@@ -225,7 +225,7 @@ romaji_typing_rule = {
u"xwa" : u"ゎ",
u"wa" : u"わ",
u"wo" : u"を",
- # u"n'" : u"ん",
+ u"n'" : u"ん",
u"nn" : u"ん",
u"wyi" : u"ゐ",
u"wye" : u"ゑ",