Skip to content

Commit 71e9f01

Browse files
committed
some pinyin readings clean up
1 parent 625cde3 commit 71e9f01

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

dics/guifan/guifan.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ export async function processGuifan(
104104
const readingNode = definitionSection.find(
105105
(d) => d.type === ElementType.Tag && d.tagName === "x-pr"
106106
);
107-
const reading = readingNode ? $(readingNode).text() : "";
107+
let reading = readingNode ? $(readingNode).text() : "";
108+
reading = reading.replace(/-|\/\//g, " ");
108109
const tradNode = filterUntil(
109110
definitionSection,
110111
(node) => node.type === ElementType.Tag && node.tagName === "dt"
@@ -144,15 +145,13 @@ export async function processGuifan(
144145
lang: "zh-CN",
145146
} satisfies StructuredContentNode;
146147
const pinyinTermEntry = new TermEntry(term.headword)
147-
.setReading(reading ?? "")
148+
.setReading(reading)
148149
.addDetailedDefinition({
149150
type: "structured-content",
150151
content: definitionContentsForReading,
151152
});
152153
const zhuyinTermEntry = new TermEntry(term.headword)
153-
.setReading(
154-
p2z((reading ?? "").replace(/-|\/\//g, " ")).replaceAll(" ", "")
155-
)
154+
.setReading(p2z(reading.replaceAll(" ", "")))
156155
.addDetailedDefinition({
157156
type: "structured-content",
158157
content: definitionContentsForReading,

dics/hanyu7/hanyu7.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,15 @@ export async function processHanyu7(
181181
data: { hanyu7: "definitions-parent" },
182182
lang: "zh-CN",
183183
} satisfies StructuredContentNode;
184+
reading = reading.replace(/-|\/\//g, " ");
184185
const pinyinTermEntry = new TermEntry(term.headword)
185186
.setReading(reading)
186187
.addDetailedDefinition({
187188
type: "structured-content",
188189
content: definitionContentsForReading,
189190
});
190191
const zhuyinTermEntry = new TermEntry(term.headword)
191-
.setReading(p2z(reading.replace(/-|\/\//g, " ")).replaceAll(" ", ""))
192+
.setReading(p2z(reading).replaceAll(" ", ""))
192193
.addDetailedDefinition({
193194
type: "structured-content",
194195
content: definitionContentsForReading,

export.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { processGuifan } from "./dics/guifan/guifan.ts";
44
import { processHanyu7 } from "./dics/hanyu7/hanyu7.ts";
55

66
const versions = {
7-
guifan: "2025/12/29.2",
8-
hanyu7: "2025/12/29.2",
7+
guifan: "2025/12/29.3",
8+
hanyu7: "2025/12/29.3",
99
};
1010

1111
const guifanPinyinDic = new Dictionary({ fileName: "guifan-pinyin.zip" });

0 commit comments

Comments
 (0)