Skip to content

Commit

Permalink
Merge 8ce5988 into 1224ff0
Browse files Browse the repository at this point in the history
  • Loading branch information
sih4sing5hong5 committed Aug 8, 2018
2 parents 1224ff0 + 8ce5988 commit 2682df8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
13 changes: 10 additions & 3 deletions 臺灣言語工具/解析整理/拆文分析器.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,16 @@ def _對齊型音處理刪節號(
for 輕聲索引, 音輕聲 in enumerate(音輕聲陣列):
型輕聲 = 詞的型輕聲[輕聲索引]
詞輕聲陣列.append(音輕聲 or 型輕聲)
詞陣列.append(
cls._拆好陣列對齊詞物件(詞的型, 詞的音, 詞輕聲陣列)
)
try:
詞陣列.append(
cls._拆好陣列對齊詞物件(詞的型, 詞的音, 詞輕聲陣列)
)
except 解析錯誤 as 錯誤:
raise 解析錯誤(
'{0}\n配對結果:{3}\n對齊「{1}」kah「{2}」'.format(
錯誤, , , str(詞陣列)
)
)
第幾字 += 型詞長
第幾音 += 1
# 確定全部的音都巡過了後,全部的型嘛攏有巡著、無tshun。
Expand Down
14 changes: 14 additions & 0 deletions 試驗/解析整理/Test拆文分析器對齊單元試驗.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,3 +759,17 @@ def test_有大括對袂濟愛一般解析錯誤(self):
= '{Haih'
with self.assertRaises(解析錯誤):
拆文分析器.對齊組物件(, )

def test_字對著標點_頭前的對齊嘛是愛顯示佇錯誤資訊(self):
= 'Ti-a--neh'
= 'Ti-a.'
with self.assertRaises(解析錯誤) as tshogoo:
拆文分析器.對齊組物件(, )
self.assertIn('Ti', tshogoo.exception.args[0])

def test_字對著標點_標點對袂齊嘛是愛顯示佇錯誤資訊(self):
= 'Ti-a--neh'
= 'Ti-a.'
with self.assertRaises(解析錯誤) as tshogoo:
拆文分析器.對齊組物件(, )
self.assertIn('neh', tshogoo.exception.args[0])

0 comments on commit 2682df8

Please sign in to comment.