修訂 | 041f5625b899c0963a550e27b25314e0644fcfad (tree) |
---|---|
時間 | 2015-01-07 17:58:06 |
作者 | ![]() |
Commiter | Takuya Nishimoto |
work around ti34783
@@ -312,6 +312,21 @@ tests = [ | ||
312 | 312 | {'text':'ト゚', 'input':'ト'}, # U+309a |
313 | 313 | {'text':'ト ゚', 'input':'ト'}, # U+309a |
314 | 314 | { |
315 | + 'input':'ガーン', | |
316 | + 'output': '⠐⠡⠒⠴', | |
317 | + 'inpos1': [0,0,1,2], | |
318 | + 'comment':'半角カタカナのポジションマッピング(level1)', | |
319 | + }, | |
320 | + { | |
321 | + 'text':'ガーン', | |
322 | + 'input':'ガーン', | |
323 | + 'output': '⠐⠡⠒⠴', | |
324 | + 'inpos2': [0,1,2,3], | |
325 | + 'inpos1': [0,0,1,2], | |
326 | + 'inpos': [0,0,1,2], | |
327 | + 'comment':'半角カタカナのポジションマッピング(level2+level1)', | |
328 | + }, | |
329 | + { | |
315 | 330 | 'input': 'Aア', |
316 | 331 | 'output': '⠰⠠⠁⠤⠁', |
317 | 332 | 'inpos1': [0,0,0,0,1], |
@@ -778,6 +778,7 @@ RE_INFOMATION = re.compile('^[A-Za-z0-9\+\@\/\#\$\%\&\*\;\.\<\>\-\_\{\}\[\] ]+$' | ||
778 | 778 | RE_GAIJI = re.compile('^[A-Za-z][A-Za-z0-9\,\.\+\- ]+$') |
779 | 779 | RE_KATAKANA = re.compile('^[ァ-ヾ]+$') |
780 | 780 | RE_HIRAGANA = re.compile('^[ぁ-ゞ]+$') |
781 | +RE_HALF_KATAKANA = re.compile('^[ヲ-゚]+$') # ff66 .. ff9f | |
781 | 782 | |
782 | 783 | NO_DAKUON_DIC = { |
783 | 784 | 'ガ' : 'カ', 'ギ' : 'キ', 'グ' : 'ク', 'ゲ' : 'ケ', 'ゴ' : 'コ', |
@@ -807,6 +808,11 @@ TAB_CODE = unichr(0x200b) | ||
807 | 808 | |
808 | 809 | def japanese_braille_separate(inbuf, logwrite, nabcc=False): |
809 | 810 | text = inbuf |
811 | + if RE_HALF_KATAKANA.match(text): | |
812 | + outbuf = text | |
813 | + inpos2 = xrange(len(outbuf)) | |
814 | + return (outbuf, inpos2) | |
815 | + | |
810 | 816 | if RE_MB_ALPHA_NUM_SPACE.match(text): |
811 | 817 | outbuf = unicode_normalize(text) |
812 | 818 | inpos2 = xrange(len(outbuf)) |