Skip to content

Commit

Permalink
0110
Browse files Browse the repository at this point in the history
  • Loading branch information
osfans committed Jan 10, 2025
1 parent 69da637 commit 27aa65b
Show file tree
Hide file tree
Showing 28 changed files with 10,528 additions and 121 deletions.
10 changes: 5 additions & 5 deletions tools/tables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

辭典 = ["漢字","說文","康熙","匯纂","漢大"]
辭典數 = len(辭典)
形碼 = ["異體字","字形變體","字形描述","部件檢索","兩分","總筆畫數","部首餘筆","五筆畫","五筆86版","五筆98版","五筆06版","倉頡三代","倉頡五代","倉頡六代","山人碼LTS","分類"]
形碼 = ["異體字","字形變體","字形描述","部件檢索","兩分","總筆畫數","部首餘筆","五筆畫","五筆86","五筆98","五筆06","倉頡三代","倉頡五代","倉頡六代","山人","分類"]

省_set = {'山西', '貴州', '甘肅', '內蒙古', '澳門', '四川', '山東', '臺灣', '雲南', '廣東', '江蘇', '海外', '吉林', '廣西', '香港', '黑龍江', '河南', '河北', '湖南', '上海', '海南', '寧夏', '北京', '遼寧', '新疆', '安徽', '福建', '重慶', '湖北', '浙江', '靑海', '江西', '陝西', '天津', '西藏'}
省集 = {'山西', '貴州', '甘肅', '內蒙古', '澳門', '四川', '山東', '臺灣', '雲南', '廣東', '江蘇', '海外', '吉林', '廣西', '香港', '黑龍江', '河南', '河北', '湖南', '上海', '海南', '寧夏', '北京', '遼寧', '新疆', '安徽', '福建', '重慶', '湖北', '浙江', '靑海', '江西', '陝西', '天津', '西藏'}

n2o_dict = {}
o2n_dict = {}
Expand Down Expand Up @@ -171,7 +171,7 @@ def 獲取同音字頻(get=False):
調典[調值] = 調
.調典 = 調典
.info = d
.加載()
.()
if .音節數 > 0:
for 字組 in .聲韻典.values():
if len(字組) < 2: continue
Expand Down Expand Up @@ -270,7 +270,7 @@ def getLangs(dicts, 參數, args):
for 字乙 in 字組乙:
字頻 += 同音字頻["".join(sorted((字甲, 字乙)))]
if 字頻 < 1.8 * n:
..append(f"{字甲}可能不讀[{}]{''.join(字組乙)[:4]}")
..append(f"{字甲}可能不讀[{}]{''.join(字組乙)[:4]}")
.info["解析日志"] = None
.info["同音字表"] = None
if .:
Expand Down Expand Up @@ -326,7 +326,7 @@ def getLangs(dicts, 參數, args):
if not in .info: .info[] = None
.info["字數"] = len(dicts)
.info["說明"] = "語言數:%d\n\n%s"%(, .說明)
省表 = sorted(省_set, key=普拼)
省表 = sorted(省集, key=普拼)
if "海外" in 省表:
省表.remove("海外")
省表.append("海外")
Expand Down
4 changes: 3 additions & 1 deletion tools/tables/_縣志.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def 行轉調類(自, 行, 格式=r"\[(\d+)\]"):

def (, ):
= _表.(, )
= .
= .簡稱
if in ("永州嵐角山", "賀州南鄕", "松江天馬", "運城", "興縣","豐城","豐城鐵路","新建","賀州江坪"):
= .lstrip("ø")
elif in ("江夏湖泗"):
Expand Down Expand Up @@ -141,6 +141,8 @@ def 統(自, 行):
= .replace("/", "")
elif in ("海門"):
if .startswith("#"): return "#"
elif in ("長治"):
if .startswith("#"): return "#"
elif in ("博白","東莞塘角"):
if .startswith("#"): return "#"
= re.findall(r"\[(.*?)(\d+)\]", )
Expand Down
24 changes: 12 additions & 12 deletions tools/tables/_表.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ def run2text(run):
if tag:
text = "".join([i + tag for i in text])
if run.font.subscript or (run.font.size and run.font.size < 115000):
text = f"{{{text}}}"
if text.startswith("{") and text.endswith("}"):
pass
elif text.startswith("[") and text.endswith("]"):
pass
else:
text = f"{{{text}}}"
return text

def isDocx(fname):
Expand Down Expand Up @@ -183,10 +188,6 @@ def setmod(自, mod):
def __str__():
if .__mod: return .__mod
return .__module__.split(".")[-1]

@property
def ():
return str()

def find(, name):
if os.sep not in name and (isXls(name) or isDocx(name)):
Expand All @@ -208,7 +209,7 @@ def spath(自):
.文件名 = ._files[0]
sname = .文件名
if not .簡稱: .簡稱 = .info["簡稱"]
if not .簡稱: .簡稱 = .
if not .簡稱: .簡稱 = str()
if not sname: sname = f"{.簡稱}.tsv"
g = .find(sname)
if not g or len(g) != 1:
Expand Down Expand Up @@ -281,7 +282,7 @@ def _正音(自, 音):
if .爲語() and .爲音:
= .strip()
= .replace("Ǿ", "Ǿ").replace("Ǿ", "").lstrip("∅︀∅Ø〇0").replace("零", "")
if . != "盛唐": = .lstrip("q")
if .簡稱 != "盛唐": = .lstrip("q")
if .startswith("I") or .startswith("1"): = "l" + [1:]
= .lower().replace("g", "ɡ").replace("ʼ", "ʰ").replace("'", "ʰ").replace("‘", "ʰ")
if not .startswith("h") and "h" in :
Expand Down Expand Up @@ -399,10 +400,10 @@ def 聲韻數(自):

def (, 更新=False):
.音表.clear()
if .過時() or 更新 and .spath: .更新()
.音典.clear()
.聲韻典.clear()
.d.clear()
if .過時() or 更新 and .spath: .更新()
if not .tpath or not os.path.exists(.tpath): return
for in open(.tpath,encoding="U8"):
= .strip()
Expand Down Expand Up @@ -436,7 +437,7 @@ def 讀(自, 更新=False):
py += "{%s}" %
else:
if .字書:
sep = "▲" if . == "匯纂" else "\t"
sep = "▲" if .簡稱 == "匯纂" else "\t"
py2, = py.split(sep, 1)
py = ("\n\n" if .d[] else "") + py2 + sep + .分註()
elif .簡稱 in ("部件檢索","字形描述"):
Expand All @@ -445,14 +446,13 @@ def 讀(自, 更新=False):
if py not in .d[]:
.d[].append(py)

def 加載(, dicts=None, 更新=False):
def 加載(, dicts, 更新=False):
.(更新)
if not .d: return
if dicts is None: return
for , 音集 in .d.items():
if not in dicts:
dicts[] = {"漢字": }
dicts[][.] = "\t".join(音集)
dicts[][.簡稱] = "\t".join(音集)

def (, ):
return tuple([:3])
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/_跳跳老鼠.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class 表(_表):
聲韻 = ""

def (, ):
= .
= .簡稱
= ""
調 = ""
if in ("臨川","奉新宋埠"):
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/_音典.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class (_表):

def (, ):
= .
= .簡稱
= ""
= ""
音標 = ""
Expand Down
Loading

0 comments on commit 27aa65b

Please sign in to comment.