Update: 初学记、佩文韵府 and 五车韵瑞

This commit is contained in:
denglifan
2026-03-22 16:18:35 +08:00
parent df475fd03f
commit 183b842090
553 changed files with 754048 additions and 169 deletions

View File

@@ -0,0 +1,37 @@
import json
prefixes = ["韻藻", ""]
def replace_pipes_no_reset(content, word):
clean_word = word
for p in prefixes:
if clean_word.startswith(p) and len(clean_word) > len(p):
clean_word = clean_word[len(p):]
break
word_len = len(clean_word)
if word_len == 0:
return content.replace("", "")
result = []
pipe_idx = 0
for char in content:
if char == "":
result.append(clean_word[pipe_idx % word_len])
pipe_idx += 1
else:
result.append(char)
return "".join(result)
test_cases = [
("首陽東", "詩采葑采葑丨丨之丨"),
("馬首東", "左傳欒黶曰吾丨丨欲丨乃歸下軍從之"),
("澗瀍東", "書洛誥我乃卜丨水東丨水西惟洛食我又卜瀍水丨亦惟洛食"),
("日夜東", "丨丨虞集詩絳桃風急丨丨丨王惲詩付與衡漳丨丨丨許有壬詩江水舟"),
("東海東", "樓鑰詩萬里逺在丨丨丨張經詩崑崙之西丨"),
]
for w, c in test_cases:
print(f"Word: {w}")
print(f"NoRst: {replace_pipes_no_reset(c, w)}")
print("-" * 40)