Skip to content

Commit

Permalink
完成 mod_廣韻 模組之單元測試,及"漢字查標音"、"切語查標音"
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanJui committed Apr 16, 2024
1 parent 0cb556d commit dd80422
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 77 deletions.
2 changes: 1 addition & 1 deletion a300_漢字查標音.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main():
# 顯示廣韻參考資料
print('\n-------------------------------------------------')
print('【廣韻查找資料】:\n')
print(f'目次:{han_ji_piau_im[0]["目次"]},小韻字序號:{han_ji_piau_im[0]["小韻字序號"]},小韻字:{han_ji_piau_im[0]["小韻字"]}')
print(f'目次:{han_ji_piau_im[0]["小韻目次"]},小韻字序號:{han_ji_piau_im[0]["小韻字序號"]},小韻字:{han_ji_piau_im[0]["小韻字"]}')

# 查詢反切上字
print('\n-------------------------------------------------')
Expand Down
68 changes: 0 additions & 68 deletions a301_漢字查拼音_old.py

This file was deleted.

15 changes: 8 additions & 7 deletions mod_廣韻.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ def han_ji_cha_siau_un(cursor, han_ji):

# 將結果轉換為字典列表
fields = [
'小韻識別號', '小韻字', '小韻切語', '小韻標音', '目次', '小韻字序號', '小韻字集', '字數',
'聲母發音部位', '清濁', '發送收', '廣韻聲母', '雅俗通聲母', '上字標音',
'聲母國際音標', '白話字聲母', '閩拼聲母', '台羅聲母', '方音聲母',
'攝', '韻目', '調', '呼', '等', '韻母', '等呼', '廣韻韻母', '雅俗通韻母', '下字標音',
'韻母國際音標', '白話字韻母', '閩拼韻母', '台羅韻母', '方音韻母',
'小韻識別號', '上字表識別號', '下字表識別號',
'小韻字', '小韻切語', '小韻標音', '小韻目次', '小韻字序號', '小韻字集', '字數',
'廣韻聲母', '七聲類', '發音部位', '清濁', '發送收',
'聲母碼', '聲母國際音標', '白話字聲母', '閩拼聲母', '台羅聲母', '方音聲母','十五音聲母',
'廣韻韻母', '目次', '攝', '韻系', '韻目', '調', '呼', '等', '韻母', '等呼', '下字標音',
'韻母碼', '韻母國際音標', '白話字韻母', '閩拼韻母', '台羅韻母', '方音韻母', '十五音韻母',
]

dict_results = [dict(zip(fields, result)) for result in results]
Expand Down Expand Up @@ -220,7 +221,7 @@ def query_table_by_field(cursor, table_name, fields, query_field, keyword):
def cha_ciat_gu_siong_ji(cursor, siong_ji):
table_name = "切語上字表"
fields = [
'識別號', '聲母識別號', '發音部位', '聲母', '清濁', '發送收',
'識別號', '廣韻聲母識別號', '七聲類', '發音部位', '聲母', '清濁', '發送收',
'聲母拼音碼', '切語上字集', '備註',
]
query_field = "切語上字集"
Expand All @@ -230,7 +231,7 @@ def cha_ciat_gu_siong_ji(cursor, siong_ji):
def cha_ciat_gu_ha_ji(cursor, ha_ji):
table_name = "切語下字表"
fields = [
'識別號', '韻母識別號', '韻系列號', '韻系行號',
'識別號', '廣韻韻母識別號', '韻系列號', '韻系行號',
'韻目索引', '目次識別號', '目次',
'攝', '韻系', '韻目', '調', '呼', '等', '韻母',
'切語下字集', '等呼', '韻母拼音碼', '備註',
Expand Down
2 changes: 1 addition & 1 deletion test_mod_廣韻.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_cha_ciat_gu_ha_ji(self):
# 检查是否存在符合条件的记录
found = False
for result in results:
if result.get('韻母') == '冬開1' and result.get('韻母拼音碼') == 'ong':
if result.get('韻母') == '冬開1舒聲' and result.get('韻母拼音碼') == 'ong':
found = True
break

Expand Down

0 comments on commit dd80422

Please sign in to comment.