Skip to content

Commit

Permalink
#37
Browse files Browse the repository at this point in the history
  • Loading branch information
nishimotz committed Apr 21, 2017
1 parent 3fcc39d commit c2c08e0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
13 changes: 13 additions & 0 deletions jptools/harness.py
Expand Up @@ -5582,4 +5582,17 @@
'input':"イマサラ ツカッテ ミタケド、⠦80's⠴ ヲ サイゲン デキル",
'output':'⠃⠵⠱⠑ ⠝⠡⠂⠟ ⠷⠕⠫⠐⠞⠰ ⠦⠼⠓⠚⠄⠎⠴ ⠔ ⠱⠃⠐⠫⠴ ⠐⠟⠣⠙',
},
# NABCCの場合に数字に続いてアルファベットがあるとスペースが入る
{
'text':'30adac67',
#'input':'30adac67',
},
{
'text':'[0-9A-Za-z]',
#'input':'⠦[0-9A-Za-z]⠴',
},
{
'text':'47news:',
#'input':'⠦47news:⠴',
},
]
19 changes: 19 additions & 0 deletions jptools/nabccHarness.py
Expand Up @@ -223,4 +223,23 @@
'input': "how are you",
'output': '⠓⠕⠺ ⠁⠗⠑ ⠽⠕⠥',
},
# 数字に続いてアルファベットがあるとスペースが入る
{
'mode':'NABCC',
'text':'30adac67',
'input':'30adac67',
'output':'⠒⠴⠁⠙⠁⠉⠖⠶',
},
{
'mode':'NABCC',
'text':'[0-9A-Za-z]',
'input':'[0-9A-Za-z]',
'output':'⡪⠴⠤⠔⡁⠤⡵⠁⠤⠵⡻',
},
{
'mode':'NABCC',
'text':'47news:',
'input':'47news:',
'output':'⠲⠶⠝⠑⠺⠎⠱',
},
]
8 changes: 7 additions & 1 deletion source/synthDrivers/jtalk/translator2.py
Expand Up @@ -419,6 +419,8 @@ def replace_alphabet_morphs(li, nabcc=False):
alp_morphs.append(mo)
elif nabcc and mo.nhyouki in '”’‘_':
alp_morphs.append(mo)
elif not alp_morphs and mo.nhyouki in '[]':
alp_morphs.append(mo)
else:
if alp_morphs:
m = concatinate_morphs(alp_morphs)
Expand All @@ -438,7 +440,7 @@ def set_pos_of_alphabets(m):
if m.nhyouki == ',':
m.hinshi1 = '記号'
m.hinshi2 = '*'
else:
elif m.nhyouki not in '[]':
m.hinshi1 = '名詞'
m.hinshi2 = 'アルファベット'

Expand Down Expand Up @@ -541,6 +543,10 @@ def should_separate(prev2_mo, prev_mo, mo, next_mo, nabcc=False, logwrite=_logwr
if mo.hinshi2 == '括弧開': return True
if mo.hinshi1 == '名詞': return True

# 数字の後のアルファベット
if nabcc and prev_mo.hinshi2 == '数' and mo.hinshi2 == 'アルファベット':
return False

# 数字の前のマスアケ
if prev_mo.nhyouki not in ('-', ',', '.', '’', '、', ':', ':', ',') and \
prev_mo.output != '⠼' and \
Expand Down

0 comments on commit c2c08e0

Please sign in to comment.