Skip to content

Commit

Permalink
Merge c2c0710 into bb45b16
Browse files Browse the repository at this point in the history
  • Loading branch information
sih4sing5hong5 authored Aug 6, 2019
2 parents bb45b16 + c2c0710 commit 7a7921f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 臺灣言語工具/基本物件/詞.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def 看語句(self):
# 接字
字型陣列.append(字串)
# 提掉ke的連字符
if 字型陣列[0] == 分字符號:
if len(字型陣列) > 0 and 字型陣列[0] == 分字符號:
字型陣列 = 字型陣列[1:]
return ''.join(字型陣列)

Expand Down
5 changes: 4 additions & 1 deletion 試驗/基本物件/Test看語句單元試驗.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class 看語句單元試驗(TestCase):

def test_接受無音的詞(self):
組物件 = 拆文分析器.建立組物件('')
組物件.內底詞 = [
Expand All @@ -14,3 +13,7 @@ def test_接受無音的詞(self):
]
分詞答案 = '梅山猴災hiong-kong-sóo tshiann2-lang5'
self.assertEqual(組物件.看語句(), 分詞答案)

def test_空ê(self):
詞物件 = 拆文分析器.建立詞物件('')
self.assertEqual(詞物件.看語句(), '')
3 changes: 3 additions & 0 deletions 試驗/整合試驗/Test字串物件一致整合試驗.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ def test_半形標點符號(self):

def test_全形標點符號(self):
self.語句 = 'ti!'

def test_空ê(self):
self.語句 = ''
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_漢羅做伙(self):
self.詞數 = 1

def test_漢羅輕聲(self):
self.語句 = '阿菊姨--a7'
self.語句 = '阿菊姨--ā'
self.詞數 = 1

def test_標點愛分開(self):
Expand Down

0 comments on commit 7a7921f

Please sign in to comment.