Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed 'jou' character in MathML reading. 'rights' should not be 'rig …
…hts'
  • Loading branch information
nishimotz committed Jun 21, 2015
1 parent 7d268f3 commit ee04409
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 63 deletions.
9 changes: 9 additions & 0 deletions include/jtalk/custom_dic_maker.py
Expand Up @@ -439,6 +439,15 @@
{ 'text':'〳', 'braille':'クノジテン ウエ'},
{ 'text':'〴', 'braille':'クノジテン ウエ ダクテン'},
{ 'text':'〵', 'braille':'クノジテン シタ'},


# 乗,1000,1000,1000,名詞,一般,*,*,*,*,乗,ジョウ,ジョー,1/2,C2
{'text':'乗',
'cost':1000,
'pos':"名詞,一般,*,*,*,*",
'speech':'ジョー',
'accent':"1/2",
},
]

class DicItem(object):
Expand Down
2 changes: 2 additions & 0 deletions include/jtalk/filter_jdic.py
Expand Up @@ -31,6 +31,8 @@ def filter_jdic(s):
s = ",".join(a)
elif a[0] == 'z' and a[11] == 'ズィー':
s = ""
elif a[0] in ('HTS', 'Hts', 'hts'):
s = ""
elif a[0] == '規' and a[11] == 'ブンマワシ':
s = ""
elif a[0] == '全' and a[11] == 'チョン':
Expand Down
13 changes: 10 additions & 3 deletions jptools/build-and-test.cmd
@@ -1,9 +1,16 @@
if exist "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" goto x64
call "C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
goto done
:x64
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
:done
SET CL=/arch:IA32 /D "_USING_V110_SDK71_"

cd ..\include\jtalk
call all-clean.cmd
call all-build.cmd
call all-install.cmd
cd ..\..\jptools
call test.cmd
cd ..\include\python-jtalk
cd ..\python-jtalk
call clean.cmd
cd ..\..\jptools
call test.cmd
7 changes: 4 additions & 3 deletions jptools/jpBrailleRunner.py
Expand Up @@ -15,13 +15,14 @@
import datetime
import cStringIO
import timeit
from harness import tests
from nabccHarness import tests as nabcc_tests
tests.extend(nabcc_tests)

jtalk_dir = os.path.normpath(
os.path.join(os.getcwdu(), '..', 'source', 'synthDrivers', 'jtalk')
)
sys.path.append(jtalk_dir)
from harness import tests
from nabccHarness import tests as nabcc_tests
tests.extend(nabcc_tests)
import translator1
import translator2
import jtalkDir
Expand Down
98 changes: 51 additions & 47 deletions jptools/mecabHarness.py
Expand Up @@ -10,8 +10,6 @@
# Mecab 辞書の第13フィールドに追加している。
# 要素3のスラッシュは形態素の区切り、スペースは形態素内のマスアケ

# some examples from nvdajp-jtalk-dic:
# http://nvdajp-jtalk-dic.heroku.com/items/
tasks = [
['あ⣿あ∫あ♪', 'アイチニーサンヨンゴーロクナナハチノテンアセキブンキゴーアオンプ'],
['鈹噯呃瘂蹻脘鑱涿癃', 'ヒアイアクアキョーカンザンタクリュー'],
Expand Down Expand Up @@ -164,6 +162,8 @@
{'text':'カムイト゚ラノ', 'speech':'カムイトラノ'}, # U+309a
{'text':'カムイト゜ラノ', 'speech':'カムイトラノ'}, # U+309c

#{'text':'★~<QUIZ>~~~~~~~~~~~~~~~', 'speech':'★~<QUIZ>~~~~~~~~~~~~~~~', 'braille':'★/~/</QUIZ/>/~/~/~/~/~/~/~/~/~/~/~/~/~/~/~'},

{'text':'触読', 'braille':'ショクドク'},
{'text':'触読式時計', 'braille':'ショクドクシキ トケイ'},
{'text':'触手話', 'braille':'ショクシュワ'},
Expand Down Expand Up @@ -247,7 +247,52 @@
{'text':'一人当り10個ずつ', 'braille':'ヒトリアタリ/イチ/ゼロ/コ/ズツ'},
{'text':'04月', 'speech':'ゼロシガツ', 'braille':'ゼロ/4ガツ'},

# 2013-08-25
{'text':'更衣室', 'braille':'コーイシツ'},
{'text':'盗撮', 'braille':'トーサツ'},
#{'text':'北の風晴れ所により一時雨', 'braille':'キタノ/カゼ/ハレ/トコロニ ヨリ/イチジ/アメ'},
{'text':'晴れ所により一時雨', 'braille':'ハレ/トコロニ ヨリ/イチジ/アメ'},
{'text':'山西', 'braille':'ヤマニシ'},
{'text':'久代', 'braille':'ヒサヨ'},
{'text':'田中梅木鈴木', 'braille':'タナカ/ウメキ/スズキ'},
{'text':'田中 梅木 鈴木', 'speech':'タナカ ウメキ スズキ'},
{'text':'山陽本線', 'speech':'サンヨーホンセン'},
{'text':'山口県', 'speech':'ヤマグチケン'},

{'text':'編集人', 'braille':'ヘンシューニン'},
{'text':'発行人', 'braille':'ハッコーニン'},
{'text':'受取人', 'braille':'ウケトリニン'},
{'text':'配達人', 'braille':'ハイタツニン'},
{'text':'管理人', 'braille':'カンリニン'},
{'text':'下請人', 'braille':'シタウケニン'},

{'text':'遠い向こう', 'speech':'トオイムコー', 'braille':'トオイ/ムコー'},
#{'text':'とおいむこう', 'speech':'トオイムコー', 'braille':'トオイ/ムコー'},
{'text':'あいうえお', 'braille':'アイウエオ'},
{'text':'かきくけこ', 'braille':'カキクケコ'},

{'text':'ありがとう', 'braille':'アリガトー'},
{'text':'有り難う', 'braille':'アリガトー'},
{'text':'有り難うございました', 'braille':'アリガトー/ゴザイ/マシ/タ'},

{'text':'展開', 'braille':'テンカイ'},
{'text':'テンカイ', 'braille':'テンカイ'},

{'text':'付点', 'speech':'フテン'},

{'text':'来る3月には', 'speech':'キタルサンガツニワ'},
#{'text':'来る途中で、', 'speech':'クルトチューデ、'},

#{'text':'これらは正しくありません', 'speech':'コレラワタダシクアリマセン'},
{'text':'正しくない', 'speech':'タダシクナイ'},
#{'text':'正しく書け', 'speech':'タダシクカケ'},
{'text':'正しく生きよう', 'speech':'タダシクイキヨウ'},
{'text':'正しく奇跡だ', 'speech':'マサシクキセキダ'},
{'text':'正しく神業だ', 'speech':'マサシクカミワザダ'},

#{'text':'設定情報を初期値に戻しました', 'speech':'セッテイジョーホーヲショキチニモドシマシタ'},

{'text':'乗', 'speech':'ジョー'},


['manage', 'マネイジ'],
['choose', 'チュウズ'],
Expand Down Expand Up @@ -291,7 +336,7 @@
{'text':'sure', 'speech':'シュア'},
{'text':'users', 'speech':'ユーザーズ'},
{'text':'some', 'speech':'サム'},
#{'text':'★~<QUIZ>~~~~~~~~~~~~~~~', 'speech':'★~<QUIZ>~~~~~~~~~~~~~~~', 'braille':'★/~/</QUIZ/>/~/~/~/~/~/~/~/~/~/~/~/~/~/~/~'},

{'text':'database', 'speech':'データベース'},
{'text':'mode', 'speech':'モウドゥ'},
{'text':'opened', 'speech':'オープンド'},
Expand Down Expand Up @@ -332,29 +377,6 @@
{'text':'levels', 'speech':'レベルズ'},
{'text':'speaks', 'speech':'スピークス'},

{'text':'更衣室', 'braille':'コーイシツ'},
{'text':'盗撮', 'braille':'トーサツ'},
#{'text':'北の風晴れ所により一時雨', 'braille':'キタノ/カゼ/ハレ/トコロニ ヨリ/イチジ/アメ'},
{'text':'晴れ所により一時雨', 'braille':'ハレ/トコロニ ヨリ/イチジ/アメ'},
{'text':'山西', 'braille':'ヤマニシ'},
{'text':'久代', 'braille':'ヒサヨ'},
{'text':'田中梅木鈴木', 'braille':'タナカ/ウメキ/スズキ'},
{'text':'田中 梅木 鈴木', 'speech':'タナカ ウメキ スズキ'},
{'text':'山陽本線', 'speech':'サンヨーホンセン'},
{'text':'山口県', 'speech':'ヤマグチケン'},

{'text':'編集人', 'braille':'ヘンシューニン'},
{'text':'発行人', 'braille':'ハッコーニン'},
{'text':'受取人', 'braille':'ウケトリニン'},
{'text':'配達人', 'braille':'ハイタツニン'},
{'text':'管理人', 'braille':'カンリニン'},
{'text':'下請人', 'braille':'シタウケニン'},

{'text':'遠い向こう', 'speech':'トオイムコー', 'braille':'トオイ/ムコー'},
#{'text':'とおいむこう', 'speech':'トオイムコー', 'braille':'トオイ/ムコー'},
{'text':'あいうえお', 'braille':'アイウエオ'},
{'text':'かきくけこ', 'braille':'カキクケコ'},

{'text':'untitled', 'speech':'アンタイトルド'},
{'text':'reopen', 'speech':'リオウプン'},
{'text':'chain', 'speech':'チェイン'},
Expand All @@ -376,24 +398,6 @@
{'text':'are', 'speech':'アー'},
{'text':'visum', 'speech':'ビズム'},

{'text':'ありがとう', 'braille':'アリガトー'},
{'text':'有り難う', 'braille':'アリガトー'},
{'text':'有り難うございました', 'braille':'アリガトー/ゴザイ/マシ/タ'},

{'text':'展開', 'braille':'テンカイ'},
{'text':'テンカイ', 'braille':'テンカイ'},

{'text':'付点', 'speech':'フテン'},

{'text':'来る3月には', 'speech':'キタルサンガツニワ'},
#{'text':'来る途中で、', 'speech':'クルトチューデ、'},

#{'text':'これらは正しくありません', 'speech':'コレラワタダシクアリマセン'},
{'text':'正しくない', 'speech':'タダシクナイ'},
#{'text':'正しく書け', 'speech':'タダシクカケ'},
{'text':'正しく生きよう', 'speech':'タダシクイキヨウ'},
{'text':'正しく奇跡だ', 'speech':'マサシクキセキダ'},
{'text':'正しく神業だ', 'speech':'マサシクカミワザダ'},

#{'text':'設定情報を初期値に戻しました', 'speech':'セッテイジョーホーヲショキチニモドシマシタ'},
{'text':'right', 'speech':'ライトゥ'},
{'text':'rights', 'speech':'ライツ'},
]
24 changes: 16 additions & 8 deletions jptools/mecabRunner.py
Expand Up @@ -7,12 +7,12 @@
import os
import sys
from glob import glob
from mecabHarness import tasks
jt_dir = os.path.normpath(
os.path.join(os.getcwdu(), '..', 'source', 'synthDrivers', 'jtalk')
)
sys.path.append(jt_dir)
from mecab import *
from mecabHarness import tasks
import jtalkDir

dic = os.path.join(jt_dir, 'dic')
Expand All @@ -22,11 +22,18 @@
def __print(s):
print s.encode('utf-8', 'ignore')

buffer = ''
_buffer = ''

def clear_morph_buffer():
global _buffer
_buffer = ''

def print_morph_buffer():
__print(_buffer)

def __print_dummy(s):
global buffer
buffer += s + '\n'
global _buffer
_buffer += s + '\n'

def Mecab_get_reading(mf, CODE_=CODE):
reading = ''
Expand All @@ -50,7 +57,8 @@ def get_reading(msg):
mf = MecabFeatures()
Mecab_analysis(s, mf)
Mecab_correctFeatures(mf)
Mecab_print(mf, __print_dummy)
Mecab_print(mf, logwrite_=__print_dummy)
Mecab_print(mf)
reading = Mecab_get_reading(mf)
mf = None
return reading
Expand Down Expand Up @@ -81,20 +89,20 @@ def runTasks(enableUserDic=False):
item = [ i['text'], i['speech'] ]
else:
item = i
buffer = ''
clear_morph_buffer()
result = get_reading(item[0])
if item[1] is not None and result[0] != item[1]:
__print('')
__print('')
__print(buffer)
print_morph_buffer()
__print('input: ' + item[0])
__print('reading expected: ' + item[1])
__print('reading result: ' + result[0])
count += 1
if len(item) > 2 and result[1] != item[2]:
__print('')
__print('')
__print(buffer)
print_morph_buffer()
__print('input: ' + item[0])
__print('braille expected: ' + item[2])
__print('braille result: ' + result[1])
Expand Down
4 changes: 2 additions & 2 deletions jptools/test.cmd
@@ -1,2 +1,2 @@
call userdicBuilder.cmd
python test.py
call userdicBuilder.cmd
python test.py|nkf

0 comments on commit ee04409

Please sign in to comment.