Skip to content

Commit

Permalink
fix: 周宁咸村、宁德九都、宁德虎浿、寿宁南阳、闽清
Browse files Browse the repository at this point in the history
  • Loading branch information
osfans committed Dec 17, 2024
1 parent ae55222 commit 7adc4ff
Show file tree
Hide file tree
Showing 113 changed files with 5,935 additions and 3,327 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
applicationId "com.osfans.mcpdict"
minSdkVersion 24
targetSdkVersion 34
versionCode 95
versionCode 96
versionName "5.7"
}

Expand Down
6 changes: 5 additions & 1 deletion tools/tables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
省_set = {'山西', '貴州', '甘肅', '內蒙古', '澳門', '四川', '山東', '臺灣', '雲南', '廣東', '江蘇', '海外', '吉林', '廣西', '香港', '黑龍江', '河南', '河北', '湖南', '上海', '海南', '寧夏', '北京', '遼寧', '新疆', '安徽', '福建', '重慶', '湖北', '浙江', '靑海', '江西', '陝西', '天津', '西藏'}

n2o_dict = {}
o2n_dict = {}

for line in open("tables/data/mulcodechar.dt", encoding="U8"):
if not line or line[0] == "#": continue
fs = line.strip().split("-")
if len(fs) < 2: continue
n2o_dict[fs[0]] = fs[1]
o2n_dict[fs[1]] = fs[0]

opencc_t2s = OpenCC("t2s.json")

Expand All @@ -39,7 +41,7 @@ def o2n(s):
if not s: return ""
t = ""
for i in s:
t += n2o_dict.get(i, i)
t += o2n_dict.get(i, i)
return t

def t2s(s, level=2):
Expand Down Expand Up @@ -212,6 +214,8 @@ def getLangs(dicts, argv, 省=None):
for i in lang.errors:
print(f"\t{i}", file=t)
lang.errors.clear()
if lang.ybs:
lang.ybs.clear()
else:
lang = import_module(f"tables.{mod}").()
d = dict()
Expand Down
20 changes: 9 additions & 11 deletions tools/tables/_縣志.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class 表(_表):
ym2 = ""

def format(self, line):
line = _表.format(self, line)
name = str(self)
if name in ("安澤和川",):
line = re.sub(r"^(.*?)[", "\\1 [", line)
Expand Down Expand Up @@ -75,12 +76,12 @@ def format(self, line):
line = line.replace("", "Ø").replace("", "")
while (newline := re.sub(r"(?<=‖)([^[]]*[^‖]){", "\\1‖{", line)) != line:
line = newline
line = re.sub("‖{", "{(連讀音)", line)
line = re.sub("‖{", "{(連讀音)", line).replace("‖", "")
elif name in ("福鼎白琳",):
line = re.sub(r"(‖)(\[\d+\])", "\\2\\1",line)
while (newline := re.sub(r"(?<=‖)([^\[\]]*[^‖]){", "\\1‖{", line)) != line:
line = newline
line = re.sub("‖{", "{(連讀音)", line)
line = re.sub("‖{", "{(連讀音)", line).replace("‖", "")
elif name in ("建德"):
line = re.sub(r"\t2\d.*$", "", line)
elif name in ("屯溪船上話"):
Expand All @@ -105,7 +106,7 @@ def format(self, line):
line = self.normS(line, "{\\1}")
elif name in ("通道菁蕪洲",):
line = re.sub("([&])(?!{)","{西官借詞}",line).replace("&{","{(西官借詞)")
elif name in ("泰興",):
elif name in ("泰興","無爲牛埠"):
line = line.lstrip("q")
elif name in ("壺關樹掌"):
line = line.lstrip("q").replace("·", "0")
Expand Down Expand Up @@ -214,7 +215,7 @@ def format(self, line):
line = line.lstrip("ø")
elif name in ("南京老派"):
line = re.sub("([,。])(()", "\\2\\1", line)
line = line.replace(",", "(又)").replace("。", "(新)")
line = line.replace(",", "(又)").replace("。", "(新)").replace(")(", " ")
line = self.normS(line, "{\\1}")
line = re.sub(r"(\{[^{}]+?)(又)([^{}]*?\})", "\\1,\\2", line)
line = re.sub(r"(\{[^{}]+?)(新)([^{}]*?\})", "\\1。\\2", line)
Expand Down Expand Up @@ -290,13 +291,10 @@ def update(self):
fs[1] = fs[1].replace("\t", "")
fs[1] = re.sub(r" (\d)", "\\1", fs[1])
sm, hzs = fs
pys = set()
for sd,hzs in re.findall(r"[(\d+[a-zA-Z]?)]([^[]]+)", fs[1]):
py = sm + ym +sd
if py not in pys:
pys.add(py)
else:
self.errors.append(f"{py} 重複")
yb = sm + ym + sd
yb = self.checkYb(yb)

hzs = self.normG(hzs)
hzs = re.findall(r"(.)[\d₁₂₃]?([<+\-/=\\\*?$&r@]?)[\d₁₂₃]? *({.*?})?", hzs)
for hz, c, js in hzs:
Expand Down Expand Up @@ -325,7 +323,7 @@ def update(self):
if js.count("{") != js.count("}"):
self.errors.append(f"大括號未成對:{js}")
js = js.replace("{", "").replace("}", "")
p = py + c + "\t" + p + js
p = yb + c + "\t" + p + js
if p not in d[hz]:
d[hz].append(p)
self.write(d)
15 changes: 14 additions & 1 deletion tools/tables/_表.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class 表:
d = defaultdict(list)
__mod = None
errors = []
ybs = set()

def setmod(self, mod):
self.__mod = mod
Expand Down Expand Up @@ -281,6 +282,16 @@ def normYb(self, yb):
yb = re.sub(r"^([ŋȵʐɱɻʒ])(\d+)$", "\\1\u030D\\2", yb)
return yb

def checkYb(self, yb):
if "\t" in yb or " " in yb:
self.errors.append(f"{yb} 音節有空格")
yb = self.normYb(yb)
if yb not in self.ybs:
self.ybs.add(yb)
else:
self.errors.append(f"{yb} 音節重複")
return yb

def isDialect(self):
return self.langType and (not self.langType.startswith("歷史音") or str(self) in ("老國音",))

Expand Down Expand Up @@ -425,6 +436,7 @@ def parse(self, fs):
return tuple(fs[:3])

def format(self, line):
line = line.replace(" ", " ")
return line

@property
Expand Down Expand Up @@ -461,7 +473,8 @@ def update(self):
js = "\t".join(fs[2:])
if not hz or len(hz) != 1: continue
if not yb: continue
if self.isDialect() and isHZ(yb[0]): continue
if self.isDialect():
if isHZ(yb[0]): continue
p = f"{yb}\t{js}"
p = p.strip()
if p not in d[hz]:
Expand Down
3 changes: 2 additions & 1 deletion tools/tables/_跳跳老鼠.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def parse(self, fs):
sy, sd, hzs = fs[1:4]
sd = re.sub(r"^[^\d]+", "", sd)
sd = self.toneMaps.get(sd, "")
hzs = hzs.replace(", ", "").replace(", ", "")
hzs = hzs.replace(", ", "")
hzs = self.normG(hzs, "〚\\1〛")
elif name in ("梅縣", ):
g = re.findall(r"^([^\d]*\d+)(.*?)$", "".join(fs))
Expand Down Expand Up @@ -214,6 +214,7 @@ def parse(self, fs):
else:
sy, sd, hzs = fs[:3]
if not yb: yb = sy + sd
yb = self.checkYb(yb)
l = list()
hzs = self.normM(hzs)
hzs = re.sub(r"(〚.*?〛)([-=])", "\\2\\1", hzs)
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/data/万源.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ x [1]夯{打~}[2]行{~列}航杭 [5]项-{~目}巷-{~道}
#iaŋ
l [2]良凉量{丈~}粮梁粱 [3]两{~个}两{斤~}辆 [5]亮谅量{数~}晾{~衣裳}
tɕ [24]刚{~才}将{~来}浆疆僵礓缰姜江豇 [3]蒋奖桨讲 [5]酱将{~帅}匠降{下~}犟{倔~}
tɕ ʰ[1]枪羌腔 [2]墙强{富~}[3]抢强{勉~}[5]像{不~样}呛{好~人}
tɕʰ [1]枪羌腔 [2]墙强{富~}[3]抢强{勉~}[5]像{不~样}呛{好~人}
ɲ [1]娘 [2]酿{酝~}[3]仰 [5]醸
ɕ [1]相{互~}箱厢湘襄镶香乡 [2]详祥降{~伏, 投~}[3]想享响饷 [5]象像{不~样}像{画~}橡相{~貌}向项=巷=
∅ [1]央秧殃 [2]羊洋烊{~化}杨阳扬疡{溃~}[3]养痒 [5]样
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/data/东至大渡口字表6.11.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ tʂ [5]桊{牛鼻~}
#ən
p [1]奔[3]本畚[5]笨
[1]喷{~气}烹澎{溅:~着一身水}[2]盆彭膨
m 们[1]蒙闷[2]门明{(白)~朝:明天}[5]焖闷{胸~}
m [0]们[1]蒙闷[2]门明{(白)~朝:明天}[5]焖闷{胸~}
f [1]分芬纷吩[2]坟[3]粉[5]奋愤忿粪分{本~}氛
t [1]登蹲吨墩敦礅蹬镫[3]等戥盹[5]邓登瞪囤{粮~}炖盾遁顿燉{~蛋:蒸鸡蛋}
[1]吞[2]屯囤{存储}豚藤誊腾[3]□{气味难闻:~人}[5]褪{把袖子~下来}
Expand Down
3 changes: 2 additions & 1 deletion tools/tables/data/临县前柏塔同音字表2022.5.19.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ tʂʰ [7]吃尺撤赤斥彻坼掣澈炽[8]着{~地,点~火,又
ʐ [7]弱[8]热日若
k [7]各格吊隔合□{种食品用淀粉及各种调料加水拌好蒸熟而成}去{用作趋向补语:出念书~哩(到外头上学去了)}□{用葱、海带及具他调料作汤:给咱先~上口调和汤}阁搁嗝旮膈骼鸽{木~~}圪{词缀}胳咯袼□{~杀,包圆:谁把我的这几根黄瓜~杀老嘞}
[7]磕可{非常:可好嘞}客刻□{~底,~总:以后~底是看更(白己)嘞么,靠人能靠老一辈子啦}瞌咳克渴{干~}□{~戏,带有赞叹的感情色彩:看你些们家~戏嘞不,两个戏还都念老大学}[8]去{动词:那~老太原哩}
x [7]郝{姓}黑喝□{~里,里:箱了~里,箱子里头}鹤核赫淌[8]□{学,不要~我}合□{在油中炸葱做汤用:给咱~上口葱}[7]恶{学习或做事情等厉害:这孩学去可~哩吧;他做营生去可~哩}鄂额扼轭
x [7]郝{姓}黑喝□{~里,里:箱了~里,箱子里头}鹤核赫淌[8]□{学,不要~我}合□{在油中炸葱做汤用:给咱~上口葱}
ŋ [7]恶{学习或做事情等厉害:这孩学去可~哩吧;他做营生去可~哩}鄂额扼轭
#iəʔ
p [7]北憋笔逼滗鳖□{饱满,今年的这瓜了都痛~}壁{~子}别{~离}毕必弼碧璧哔
[7]撇匹劈辟霹瞥[8]别{~人、~处、~东西}鼻{~子}
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/data/佳县佳芦镇同音字表20211231.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ n [2]泥倪宜谊尼疑-匿[3]你拟[5]泥{被泥缠住}
l [1]□{圪~:挠痒痒}[2]犁黎离篱璃梨厘狸[3]礼李里理鲤[5]例厉励丽隶利痢吏
ʨ [1]鸡稽饥肌几{茶~}基机讥精-睛-{眼~仁子}[3]挤己几{~个}井-[5]祭际穄济剂计继髻技妓寄冀纪记忌既季镜-净寂静-{~个悄悄}
ʨʰ [1]妻欺期{时~}清-轻-青-{胳膊黑~}[2]齐脐畦奇骑岐祁鳍其棋旗杞祈[3]启企起岂[5]砌契器弃气汽
ɕ [1]西息犀溪奚兮携牺希稀恓{~惶}栖[1]肥-[3]洗玺徙嬉熙喜蟢□{~~sɿ55 sɿ42:贬义词,形容人爱在背地说话,说话不大气}[5]细婿系係戏
ɕ [1]西息犀溪奚兮携牺希稀恓{~惶}栖[2]肥-[3]洗玺徙嬉熙喜蟢□{~~sɿ55 sɿ42:贬义词,形容人爱在背地说话,说话不大气}[5]细婿系係戏
Ø [1]伊衣依揖醫[2]仪移遗蝇-赢-疑=[3]蚁倚椅矣已以□{把光线挡住}尾-[5]艺义议易{难~}夷姨肄意异毅忆亿抑翼疫役翻译□{刺眼:太阳把我眼~的}
#u
p [3]补捕堡-{吴~}[5]布怖步部=
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/data/冷水滩.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ l [1]□{~钱:赚钱}聋[2]笼{鸟~}胧隆窿龙咙珑同铜桐茼筒童
n [2]农脓浓
ts [1]棕鬃宗综中{当~}忠衷终踪钟盅[3]总种{品~}肿[5]粽中{打~}众纵种{耕~}
tsʰ [1]聪匆葱囱冲充揰舂[3]宠揰{推搡}[5]冲{说话语气重}
s [31松{~弛}[3]怂耸㧐[5]送宋
s [1]松{~弛}[3]怂耸㧐[5]送宋
z [2]丛虫崇从松{~树}重{~做}[5]仲诵颂讼重{轻~}
k [1]公蚣工功攻弓躬宫恭龚[3]汞拱巩[5]贡供□{~桌子:钻进桌子底下}
g [5]共
Expand Down
2 changes: 1 addition & 1 deletion tools/tables/data/南京總合.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ tɕʰ⑤恰洽掐狹

uɒʔ
ts ⑤□(打掃 如~~乾瀞)
s □(。~kuɒʔ 疾也)
s □(。~kuɒʔ 疾也)
ʂ ⑤刷□(抽打)
k ⑤刮括颳聒
x ⑤滑猾劃豁
Expand Down
Loading

0 comments on commit 7adc4ff

Please sign in to comment.