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 6d12eef commit aca189a
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 25 deletions.
Binary file modified Ho_Lok_Ue.db
Binary file not shown.
1 change: 0 additions & 1 deletion Nga_Siok_Thong.sqbpro

This file was deleted.

Binary file removed Nga_Siok_Thong_Sip_Ngoo_Im.db
Binary file not shown.
Empty file removed Sip_Ngoo_Im.db
Empty file.
Empty file removed Tai_Loo_Han_Ji_Khoo
Empty file.
Binary file removed Tai_Loo_Han_Ji_Khoo.db
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion mod_huan_tshiat_test.py → __mod_huan_tshiat_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mod_huan_tshiat_test.py 內容

from mod_huan_tshiat import siong_ji_tsa_siann_bu, ha_ji_tsa_un_bu
from __mod_huan_tshiat import ha_ji_tsa_un_bu, siong_ji_tsa_siann_bu

# 測試 siong_ji_tsa_siann_bu 函數
siong_ji = "普"
Expand Down
File renamed without changes.
25 changes: 13 additions & 12 deletions a600_漢字查廣韻擬音_Excel.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#==============================================================================
# 透過 Excel ,使用廣韻的反切方法,查找漢字的羅馬拼音。
#
#
# 操作方式:
# - 輸入欲查詢羅馬拼音之漢字;
# - 輸入廣韻的查找索引資料。
#
#
# ipython a900_廣韻反切查羅馬拼音.ipynb 攝 "書涉 (《廣韻·入聲·葉·攝》)"
#==============================================================================

import sys

import xlwings as xw

from mod_huan_tshiat import tshu_tiau
from __mod_huan_tshiat import tshu_tiau
from mod_於字典網站查詢漢字之廣韻切語發音 import fetch_kong_un_info


Expand Down Expand Up @@ -54,36 +55,36 @@ def fetch_arg():
## 開啟可執行反切查羅馬拼音之活頁簿檔案
# 1. 開啟 Excel 活頁簿檔案: .\tools\廣韻反切查音工具.xlsx ;
# 2. 擇用 "反切" 工作表。
#
#
# [程式規格]:
# - 使用 xlwings 套件,操作 Excel 檔案;
# - 以上兩步的作業程序,都用 try: exception: 形式執行,遇有意外事件發生時,於畫面顯示問題狀況,然後終止程式的繼續執行。

try:
# 指定 Excel 檔案路徑
file_path = r'.\\tools\\廣韻反切查音工具.xlsx'

# 使用 xlwings 開啟 Excel 檔案
wb = xw.Book(file_path)

# 選擇名為 "反切" 的工作表
sheet = wb.sheets['反切']

# 將變數值填入指定的儲存格
sheet.range('C2').value = han_ji
for item in tshiat_gu_list:
# 將漢字之切語填入指定的儲存格
# 將漢字之切語填入指定的儲存格
sheet.range('D2').value = item["tshiat_gu"]
# 將切語上字填入指定的儲存格
sheet.range('C5').value = siong_ji = item["tshiat_gu"][0]
# 將切語下字填入指定的儲存格
sheet.range('C6').value = ha_ji = item["tshiat_gu"][1]
# 將切語下字所屬之四聲調類填入指定的儲存格
sheet.range('E6').value = tshu_tiau(item["tiau"])
# 將切語下字所屬之四聲調類填入指定的儲存格
sheet.range('E6').value = tshu_tiau(item["tiau"])

# 從 D8 儲存格取出值,存放於變數 tai_lo_phing_im
tai_lo_phing_im = sheet.range('D8').value

#=======================================================
# 顯示查詢結果
#=======================================================
Expand Down
10 changes: 5 additions & 5 deletions a600_漢字查廣韻擬音_SQLite.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#==============================================================================
# 透過 Excel ,使用廣韻的反切方法,查找漢字的羅馬拼音。
#
#
# 操作方式:
# - 輸入欲查詢羅馬拼音之漢字;
# - 輸入廣韻的查找索引資料。
#
#
# ipython a900_廣韻反切查羅馬拼音.ipynb 攝 "書涉 (《廣韻·入聲·葉·攝》)"
#==============================================================================

import sys

from mod_huan_tshiat import query_tiau_ho, tshu_tiau
from mod_Query_for_Tshiat_Gu import query_tshiat_gu_ha_ji, query_tshiat_gu_siong_ji
from __mod_huan_tshiat import query_tiau_ho, tshu_tiau
from __mod_Query_for_Tshiat_Gu import query_tshiat_gu_ha_ji, query_tshiat_gu_siong_ji
from mod_於字典網站查詢漢字之廣韻切語發音 import fetch_kong_un_info


Expand Down Expand Up @@ -86,7 +86,7 @@ def fetch_arg():

# 組合台羅拼音
tai_lo_phing_im = f"{tai_lo_siann_bu}{tai_lo_un_bu}{tiau_ho}"

#=======================================================
# 顯示查詢結果
#=======================================================
Expand Down
4 changes: 2 additions & 2 deletions mod_河洛話.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def han_ji_ca_piau_im(cursor, han_ji, reading_type="文讀音"):
常用度,
摘要說明
FROM
台羅音標漢字庫
漢字庫
WHERE
漢字 = ? AND ({reading_condition})
ORDER BY
Expand All @@ -66,7 +66,7 @@ def han_ji_ca_piau_im(cursor, han_ji, reading_type="文讀音"):
常用度,
摘要說明
FROM
台羅音標漢字庫
漢字庫
WHERE
漢字 = ?
ORDER BY
Expand Down
Binary file not shown.
8 changes: 4 additions & 4 deletions test_mod_雅俗通.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
import sqlite3
import unittest

from mod_雅俗通 import han_ji_cha_piau_im, split_cu_im # 假設你將函數保存在 'your_module.py' 中
from __mod_雅俗通 import han_ji_cha_piau_im, split_cu_im # 假設你將函數保存在 'your_module.py' 中


class TestHanJiChaPiauIm(unittest.TestCase):

@classmethod
def setUpClass(cls):
# 在所有測試開始前,連接資料庫
cls.conn = sqlite3.connect('Nga_Siok_Thong_Sip_Ngoo_Im.db') # 替換為實際資料庫路徑
cls.cursor = cls.conn.cursor()

@classmethod
def tearDownClass(cls):
# 在所有測試結束後,關閉資料庫連接
cls.conn.close()

def test_han_ji_cha_piau_im(self):
# 測試漢字查詢功能
han_ji = '不'
Expand Down
Binary file removed working.xlsx
Binary file not shown.

0 comments on commit aca189a

Please sign in to comment.