Skip to content

Commit

Permalink
更新【河洛話漢字庫】
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanJui committed Nov 3, 2024
1 parent aca189a commit 6edb2ce
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
Binary file modified Ho_Lok_Ue.db
Binary file not shown.
4 changes: 2 additions & 2 deletions a702_查找及填入漢字標音.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
type = get_sound_type(wb)
han_ji_khoo = get_han_ji_khoo(wb)
if han_ji_khoo == "河洛話":
ca_han_ji_thak_im(wb, sheet_name='漢字注音', cell='V3', type="白話音", han_ji_khoo="河洛話", db_name='Ho_Lok_Ue.db', module_name='mod_河洛話', function_name='han_ji_ca_piau_im')
ca_han_ji_thak_im(wb, sheet_name='漢字注音', cell='V3', hue_im="白話音", han_ji_khoo="河洛話", db_name='Ho_Lok_Ue.db', module_name='mod_河洛話', function_name='han_ji_ca_piau_im')
else:
ca_han_ji_thak_im(wb, sheet_name='漢字注音', cell='V3', type="文讀音", han_ji_khoo="廣韻", db_name='Kong_Un.db', module_name='mod_廣韻', function_name='han_ji_ca_piau_im')
ca_han_ji_thak_im(wb, sheet_name='漢字注音', cell='V3', hue_im="文讀音", han_ji_khoo="廣韻", db_name='Kong_Un.db', module_name='mod_廣韻', function_name='han_ji_ca_piau_im')

# (3) A740: 將【漢字注音】工作表的內容,轉成 HTML 網頁檔案。
# tng_sing_bang_iah(wb, '漢字注音', 'V3')
Expand Down
10 changes: 5 additions & 5 deletions mod_河洛話.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@
# 白話音:常用度 > 0.40;最常用的讀音其值為 0.60,次常用的讀音其值為 0.50;其餘則使用數值 0.59 ~ 0.41。
# 其 它:常用度 > 0.00;使用數值 0.40 ~ 0.01;使用時機為:(1)方言地方腔;(2) 罕見發音;(3) 尚未查證屬文讀音或白話音 。
# ==========================================================
def han_ji_ca_piau_im(cursor, han_ji, reading_type="文讀音"):
def han_ji_ca_piau_im(cursor, han_ji, hue_im="文讀音"):
"""
根據漢字查詢其台羅音標及相關讀音資訊,並將台羅音標轉換為台語音標。
若資料紀錄在常用度欄位儲存值為空值(NULL),則將其視為 0,因此可排在查詢結果的最後。
:param cursor: 數據庫游標
:param han_ji: 欲查詢的漢字
:param reading_type: 查詢的讀音類型,可以是 "文讀音"、"白話音" 或 "其它"
:param hue_im: 查詢的讀音類型,可以是 "文讀音"、"白話音" 或 "其它"
:return: 包含讀音資訊的字典列表,包含台語音標、聲母、韻母、聲調。
"""

# 將文白通用音視為第一優選
common_reading_condition = "常用度 >= 0.81 AND 常用度 <= 1.0"

# 根據不同讀音類型,添加額外的查詢條件
if reading_type == "文讀音":
if hue_im == "文讀音":
reading_condition = f"({common_reading_condition}) OR (常用度 >= 0.61 AND 常用度 < 0.81)"
elif reading_type == "白話音":
elif hue_im == "白話音":
reading_condition = f"({common_reading_condition}) OR (常用度 > 0.40 AND 常用度 < 0.61)"
elif reading_type == "其它":
elif hue_im == "其它":
reading_condition = "常用度 > 0.00 AND 常用度 <= 0.40"
else:
reading_condition = "1=1" # 查詢所有
Expand Down
Binary file not shown.
5 changes: 2 additions & 3 deletions p702_Ca_Han_Ji_Thak_Im.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from mod_標音 import TL_Tng_Zu_Im, is_valid_han_ji, split_zu_im


def ca_han_ji_thak_im(wb, sheet_name='漢字注音', cell='V3', type="白話音", han_ji_khoo="河洛話", db_name='Ho_Lok_Ue.db', module_name='mod_河洛話', function_name='han_ji_ca_piau_im'):
def ca_han_ji_thak_im(wb, sheet_name='漢字注音', cell='V3', hue_im="白話音", han_ji_khoo="河洛話", db_name='Ho_Lok_Ue.db', module_name='mod_河洛話', function_name='han_ji_ca_piau_im'):
# 顯示「已輸入之拼音字母及注音符號」
named_range = wb.names['顯示注音輸入']
named_range.refers_to_range.value = True
Expand Down Expand Up @@ -91,8 +91,7 @@ def ca_han_ji_thak_im(wb, sheet_name='漢字注音', cell='V3', type="白話音"
sheet.range((row - 1, col)).value = lo_ma_im_piau
sheet.range((row + 1, col)).value = zu_im_hu_ho
else:
# result = han_ji_ca_piau_im(cursor, han_ji, type)
result = han_ji_ca_piau_im(cursor, han_ji)
result = han_ji_ca_piau_im(cursor=cursor, han_ji=han_ji, hue_im=hue_im)

if result:
if han_ji_khoo == "河洛話":
Expand Down

0 comments on commit 6edb2ce

Please sign in to comment.