Coverage for src / wiktextract / extractor / zh / tags.py: 98%

35 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-12-05 07:46 +0000

1from .models import WordEntry 

2from .topics import LABEL_TOPICS 

3 

4GENDER_TAGS: dict[str, str] = { 

5 "陰性": "feminine", 

6 "阴性": "feminine", 

7 "陰性形式": "feminine", 

8 "陰性等價詞": "feminine", 

9 "陽性": "masculine", 

10 "陽性形式": "masculine", 

11 "中性": "neuter", 

12 "中性形式": "neuter", 

13} 

14 

15NUMBER_TAGS: dict[str, str | list[str]] = { 

16 "單數": "singular", 

17 "单数": "singular", 

18 "複數": "plural", 

19 "复数": "plural", 

20 "定單數": ["definite", "singular"], 

21 "定单数": ["definite", "singular"], 

22 "不定單數": ["indefinite", "singular"], 

23 "不定单数": ["indefinite", "singular"], 

24 "不定複數": ["indefinite", "plural"], 

25 "不定复数": ["indefinite", "plural"], 

26 "定複數": ["definite", "plural"], 

27 "斜格複數": ["oblique", "plural"], 

28 "主格單數": ["nominative", "singular"], 

29 "主格複數": ["nominative", "plural"], 

30 "屬格單數": ["genitive", "singular"], 

31 "屬格複數": ["genitive", "plural"], 

32 "陰性單數": ["feminine", "singular"], 

33 "陽性單數": ["masculine", "singular"], 

34 "陰性複數": ["feminine", "plural"], 

35 "陽性複數": ["masculine", "plural"], 

36 "中性複數": ["neuter", "plural"], 

37 "中性單數": ["neuter", "singular"], 

38 "賓格單數": ["accusative", "singular"], 

39 "賓格複數": ["accusative", "plural"], 

40 "無複數": "no-plural", 

41 # Template:nb-noun-m1 

42 "定指單數": ["definite", "singular"], 

43 "定指複數": ["definite", "plural"], 

44 "複": "plural", 

45 "單": "singular", 

46} 

47 

48# https://en.wikipedia.org/wiki/Count_noun 

49COUNT_TAGS: dict[str, str] = { 

50 "可數": "countable", 

51 "不可數": "uncountable", 

52} 

53 

54OTHER_TAGS: dict[str, str] = { 

55 "指小詞": "diminutive", 

56 "指小": "diminutive", 

57 "變格類型": "declension-pattern-of", 

58 "屬格": "genitive", 

59 "部分格": "partitive", 

60 "個人": "person", 

61 "無屈折": "indeclinable", 

62 "諺文": "hangeul", 

63 "漢字": "hanja", 

64 # Template:cs-proper noun 

65 "相關形容詞": ["relational", "adjective"], 

66 "關係形容詞": ["relational", "adjective"], 

67 "居民稱謂詞": "demonym", 

68 "女性居民稱謂詞": ["feminine", "demonym"], 

69 "定賓格": ["definite", "accusative"], 

70 "定宾格": ["definite", "accusative"], 

71 "拉丁字母拼寫": "romanization", 

72 "定指賓格": ["definite", "accusative"], 

73 "前元音和諧變體": "front-vowel-harmony", 

74 # Template:zh-forms 

75 "正體": "Standard-Chinese", 

76 "繁體": "Traditional-Chinese", 

77 "簡體": "Simplified-Chinese", 

78 "異體": "alternative", 

79 "仿譯詞": "calque", 

80 "貶稱詞": "pejorative", 

81 # Template:ms-noun 

82 "爪夷文": "Jawi", 

83 "非正式第一人稱屬格": ["informal", "first-person", "genitive"], 

84 "不禮貌第二人稱屬格": ["impolite", "second-person", "genitive"], 

85 "第三人稱屬格": ["third-person", "genitive"], 

86 "印尼語": "Indonesian", 

87 "姓氏": "surname", 

88} 

89 

90VERB_TAGS: dict[str, str] = { 

91 "及物": "transitive", 

92 "不及物": "intransitive", 

93 "动宾结构": "verb-object", 

94 "非完": "imperfective", 

95 "完": "perfective", 

96 "強變化": "strong", 

97 "動名詞": "supine", 

98 "命令式": "imperative", 

99 # Template:ar-verb 

100 "第I類": "form-i", 

101 "第II類": "form-ii", 

102 "第III類": "form-iii", 

103 "第IV類": "form-iv", 

104 "第V類": "form-v", 

105 "第VI類": "form-vi", 

106 "第VII類": "form-vii", 

107 "第IX類": "form-ix", 

108 "第X類": "form-x", 

109 "第XII類": "form-xii", 

110 "第XIII類": "form-xiii", 

111 "第XIV類": "form-xiv", 

112 "第XV類": "form-xv", 

113 "第Iq類": "form-iq", 

114 "第IIq類": "form-iiq", 

115 "第IIIq類": "form-iiiq", 

116 "第IVq類": "form-ivq", 

117 # Module:Jpan-headword 

118 "他動詞": "transitive", 

119 "自動詞": "intransitive", 

120 "自、他動詞": ["transitive", "intransitive"], 

121 "五段": "godan", 

122 "一段": "ichidan", 

123 "サ行": "suru", 

124 "カ行": "kuru", 

125 "イ形": "-i", 

126 "ナ形": "-na", 

127 "四段": "yodan", 

128 "二段": "nidan", 

129 "ラ行": "-ri", 

130 "ナリ": "-nari", 

131 "タリ": "-tari", 

132 # Template:ja-conj-bungo 

133 "語幹形態": "stem", 

134 "對比連接詞": ["contrastive", "conjunction"], 

135 "因果連接詞": ["causative", "conjunction"], 

136 "條件連接詞": ["conditional", "conjunction"], 

137 "過去式 (第一手消息)": "past", 

138 "過去式 (第二手消息)": "past", 

139 "完成式 (自覺動作)": "perfect", 

140 "完成式 (自然事件)": ["perfect", "natural"], 

141 "完成進行式": ["perfect", "continuative"], 

142 "意志形": "volitional", 

143 "副詞": "adverbial", 

144 "無助動詞": "no-auxiliary", 

145 "有助動詞": "auxiliary", 

146 # Template:ja-na 

147 "簡體否定": ["informal", "negative"], 

148 "簡體過去": ["informal", "past"], 

149 "簡體過去否定": ["informal", "past", "negative"], 

150 "敬體": "formal", 

151 "敬體否定": ["formal", "negative"], 

152 "敬體過去": ["formal", "past"], 

153 "敬體過去否定": ["formal", "past", "negative"], 

154 "連接形": "conjunctive", 

155 "暫定形": "provisional", 

156 "推量形": "volitional", 

157 "連用形": "adverbial", 

158 "程度形": "degree", 

159} 

160 

161# https://en.wikipedia.org/wiki/Japanese_grammar#Stem_forms 

162JA_STEM_FORMS: dict[str, str] = { 

163 "未然形": "imperfective", 

164 "連用形": "continuative", 

165 "終止形": "terminal", 

166 "連體形": "attributive", 

167 "連体形": "attributive", 

168 "假定形": "hypothetical", 

169 "仮定形": "hypothetical", 

170 "命令形": "imperative", 

171 "已然形": "realis", 

172} 

173 

174# https://en.wikipedia.org/wiki/Voice_(grammar) 

175VOICE_TAGS: dict[str, str | list[str]] = { 

176 "被動形": "passive", 

177 "使役形": "causative", 

178 "可能形": "potential", 

179 "意志形": "volitional", 

180 "否定形": "negative", 

181 "否定連用形": ["negative", "continuative"], 

182 "尊敬形": "formal", 

183 "完成形": "perfective", 

184 "接續形": "conjunctive", 

185 "條件形": ["hypothetical", "conditional"], 

186} 

187 

188COMPARISON_TAGS: dict[str, str] = { 

189 # https://en.wikipedia.org/wiki/Comparison_(grammar) 

190 "原级": "positive", 

191 "比較級": "comparative", 

192 "最高級": "superlative", 

193} 

194 

195TENSE_TAGS = { 

196 "過去時": "preterite", 

197 "過去式": "past", 

198 "過去分詞": ["past", "participle"], 

199 "現在時": "present", 

200 "第三人稱單數現在時": ["third-person", "singular", "present"], 

201 "助動詞": "auxiliary", 

202 # Template:de-verb 

203 "弱變化": "weak", 

204 "弱变化": "weak", 

205 "第三人稱單數簡單現在時": ["third-person", "singular", "present"], 

206 "現在分詞": ["present", "participle"], 

207 "一般過去時及過去分詞": ["past", "participle"], 

208 # Template:it-verb 

209 "第一人稱單數 現在時": ["first-person", "singular", "present"], 

210 "第一人稱單數 先過去時": ["first-person", "singular", "past", "historic"], 

211 # Template:de-adj 

212 "強變化主格陽性單數": ["strong", "nominative", "masculine", "singular"], 

213 # Template:la-verb 

214 "现在时不定式": ["present", "infinitive"], 

215 "完成时主动式": ["perfect", "active"], 

216 "目的动名词": "supine", 

217 # Template:ar-verb 

218 "非過去時": "non-past", 

219 "動詞性名詞": "noun-from-verb", 

220 "主動分詞": ["active", "participle"], 

221 "被動分詞": ["passive", "participle"], 

222 # Template:it-verb 

223 # https://zh.wiktionary.org/wiki/Module:It-headword 

224 "第一人稱單數現在時": ["first-person", "singular", "present"], 

225 "第一人稱單數先過去時": ["first-person", "singular", "past", "historic"], 

226 "第三人稱單數先過去時": ["third-person", "singular", "past", "historic"], 

227 "第一人稱單數過去分詞": ["first-person", "singular", "past", "participle"], 

228 "第三人稱單數過去分詞": ["third-person", "singular", "past", "participle"], 

229 "第一人稱單數未完成時": ["first-person", "singular", "imperfect"], 

230 "第三人稱單數未完成時": ["third-person", "singular", "imperfect"], 

231 "第一人稱單數未來時": ["first-person", "singular", "future"], 

232 "第三人稱單數未來時": ["third-person", "singular", "future"], 

233 "第一人稱單數現在時虛擬式": ["first-person", "singular", "subjunctive"], 

234 "第三人稱單數現在時虛擬式": ["third-person", "singular", "subjunctive"], 

235 "第一人稱單數未完成時虛擬式": [ 

236 "first-person", 

237 "singular", 

238 "imperfect", 

239 "subjunctive", 

240 ], 

241 "第三人稱單數未完成時虛擬式": [ 

242 "third-person", 

243 "singular", 

244 "imperfect", 

245 "subjunctive", 

246 ], 

247 # Template:es-verb 

248 "第一人稱單數過去時": ["first-person", "singular", "past"], 

249 # Template:ast-verb-ar 

250 "第一人稱單數直陳現在時": [ 

251 "first-person", 

252 "singular", 

253 "indicative", 

254 "present", 

255 ], 

256} 

257 

258GRAMMATICAL_TAGS: dict[str, str] = { 

259 **GENDER_TAGS, 

260 **NUMBER_TAGS, 

261 **COUNT_TAGS, 

262 **OTHER_TAGS, 

263 **VERB_TAGS, 

264 **JA_STEM_FORMS, 

265 **VOICE_TAGS, 

266 **COMPARISON_TAGS, 

267 **TENSE_TAGS, 

268} 

269 

270# https://zh.wiktionary.org/wiki/Template:Label 

271# https://zh.wiktionary.org/wiki/Module:Labels/data 

272# https://zh.wiktionary.org/wiki/Template:Qualifier 

273# https://zh.wiktionary.org/wiki/Template:古 

274# https://zh.wiktionary.org/wiki/Template:注释 

275LABEL_TAGS = { 

276 "棄用": "obsolete", 

277 "弃用": "obsolete", 

278 "比喻": "figuratively", 

279 "古": "archaic", 

280 "陽": "masculine", 

281 "陰": "feminine", 

282 "喻": "figuratively", 

283 "書": "literary", 

284 "口": "colloquial", 

285 "俚": "slang", 

286 "俗": "slang", 

287 "方": "dialectal", 

288 "废": "obsolete", 

289 "貶": "derogatory", 

290 "罕": "rare", 

291 "引": "broadly", 

292 "現已罕用": "archaic", 

293 # Module:Labels/data 

294 "back slang": "slang", 

295 "synecdochically": "synecdoche", 

296 "不再自由造詞": "idiomatic", 

297 "不及物": "intransitive", 

298 "不可數": "uncountable", 

299 "不定": "indefinite", 

300 "不常見": "uncommon", 

301 "不推薦使用": "proscribed", 

302 "中性": "neuter", 

303 "中間被動語態": "mediopassive", 

304 "中間語態": "middle", 

305 "主動語態": "active", 

306 "主要用於否定": ["usually", "with-negation"], 

307 "交互": "reciprocal", 

308 "以單數形式": "singular", 

309 "以複數形式": "in-plural", 

310 "作定語": "attributive", 

311 "作格": "ergative", 

312 "作表語": "predicative", 

313 "使役": "causative", 

314 "俗語": "idiomatic", 

315 "俚語": "slang", 

316 "俚语": "slang", 

317 "兒童用語": "childish", 

318 "公文": "bureaucratese", 

319 "冒犯": "offensive", 

320 "分詞": "participle", 

321 "前古典": "pre-Classical", 

322 "助動詞": "auxiliary", 

323 "助記符": "mnemonic", 

324 "及物": "transitive", 

325 "反問句": "rhetoric", 

326 "反身": "reflexive", 

327 "口語": "colloquial", 

328 "口语": "colloquial", 

329 "古舊": "archaic", 

330 "可數": "countable", 

331 "同性戀俚語": ["slang", "LGBT"], 

332 "名詞化": "noun-from-verb", 

333 "唯單": "singular-only", 

334 "唯複": "plural-only", 

335 "國際音標": "IPA", 

336 "基數詞": "cardinal", 

337 "大寫": "capitalized", 

338 "委婉": "euphemistic", 

339 "字面義": "literally", 

340 "完整": "perfect", 

341 "完整體": "perfective", 

342 "定語": "attributive", 

343 "實詞": "substantive", 

344 "尊敬": "honorific", 

345 "敬語": "honorific", 

346 "敬语": "honorific", 

347 "常用複數": "plural-normally", 

348 "幽默": "humorous", 

349 "序數詞": "ordinal", 

350 "廣義來說": "broadly", 

351 "引申": "broadly", 

352 "弱祈使式": "jussive", 

353 "強調": "emphatic", 

354 "後古典": "obsolete", 

355 "性別中立": "gender-neutral", 

356 "情態": "modal", 

357 "愛稱": "endearing", 

358 "所有格代詞": ["possessive", "pronoun", "without-noun"], 

359 "押韻俚語": "slang", 

360 "抽象名詞": "abstract-noun", 

361 "擬態詞": "ideophonic", 

362 "擬聲詞": "onomatopoeic", 

363 "新詞": "neologism", 

364 "方言": "dialectal", 

365 "書面": "literary", 

366 "书面": "literary", 

367 "有比較級": "comparable", 

368 "有生": "animate", 

369 "正式": "formal", 

370 "歷史": "historical", 

371 "比喻義": "figuratively", 

372 "無人稱": "impersonal", 

373 "無比較級": "not-comparable", 

374 "無生": "inanimate", 

375 "焦點": "focus", 

376 "狹義": "narrowly", 

377 "監獄俚語": "slang", 

378 "直陳語氣": "indicative", 

379 "短信": "Internet", 

380 "祈使語氣": "imperative", 

381 "禮貌": "polite", 

382 "種族歧視語": "slur", 

383 "粉絲用語": ["slang", "lifestyle"], 

384 "粗俗": "vulgar", 

385 "系動詞": "copulative", 

386 "網路用語": "Internet", 

387 "縮寫": "abbreviation", 

388 "罕用": "rare", 

389 "臨時語": "nonce-word", 

390 "虛擬語氣": "subjunctive", 

391 "表語": "predicative", 

392 "被動語態": "passive", 

393 "視覺方言": "pronunciation-spelling", 

394 "親切": "familiar", 

395 "詈語": "expletive", 

396 "詩歌": "poetic", 

397 "誇飾": "excessive", 

398 "語中音省略": "syncope", 

399 "諷刺": "sarcastic", 

400 "謙遜": "humble", 

401 "貶義": "derogatory", 

402 "轉喻義": "metonymically", 

403 "返璞詞": "retronym", 

404 "過時": "dated", 

405 "陰性": "feminine", 

406 "陽性": "masculine", 

407 "雙及物動詞": "ditransitive", 

408 "靜態動詞": "stative", 

409 "非完整": "imperfect", 

410 "非完整體": "imperfective", 

411 "非常罕用": "rare", 

412 "非標準": "nonstandard", 

413 "非标准": "nonstandard", 

414 "非標準形式": "nonstandard", 

415 "非正式": "informal", 

416 "首字母縮略詞": "initialism", 

417 "駭客語": ["Leet", "Internet"], 

418 "高語域": "honorific", 

419 "中醫": "Traditional-Chinese-Medicine", 

420 "修辭學": "rhetoric", 

421 "印度教": "Hinduism", 

422 "摩門教": "Mormonism", 

423 "物理": "particle", 

424 "猶太教": "Judaism", 

425 "納粹主義": "Nazism", 

426 "網際網路": "Internet", 

427 "耆那教": "Jainism", 

428 "聖經": "Biblical", 

429 "解剖學": "anatomy", 

430 "貴格會": "Quakerism", 

431 "錫克教": "Sikhism", 

432 "馬克思主義": "Marxism", 

433 # also from Module:Labels/data, but translated manually 

434 "喃字": "Chu-Nom", 

435 "反身代詞": "reflexive", 

436 "字面意義": "literally", 

437 "成語": "Chengyu", 

438 "及物、不及物": ["transitive", "intransitive"], 

439 "集合名詞": "collective", 

440 "控制動詞": "control-verb", 

441 "省略": "ellipsis", 

442 "分數": "fractional", 

443 "以雙數形式": "dual", 

444 "主要用於否定複數": ["negative", "plural"], 

445 "數詞縮寫": ["numeral", "abbreviation"], 

446 "主要用於肯定": "positive", 

447 "古典": "Classical", 

448 "中國大陸": "Mainland-China", 

449 "書面語": "literary", 

450 "文言": "literary", 

451 "詞幹": "stem", 

452 "烏爾都語寫法": "Urdu", 

453 "波斯-阿拉伯字母": "Perso-Arabic", 

454 # Template:kok-pos 

455 "拉丁字母": ["Latin", "character"], 

456 "卡納達文": ["Kannada", "character"], 

457 "尼瓦爾文拼寫": "Newa", 

458} 

459 

460# example sentence template 

461# https://zh.wiktionary.org/wiki/Template:Zh-x 

462# https://zh.wiktionary.org/wiki/Module:Zh-usex/data 

463ZH_X_TAGS = { 

464 "繁體": "Traditional-Chinese", 

465 "繁體和": "Traditional-Chinese", 

466 "簡體": "Simplified-Chinese", 

467 "繁體和簡體": ["Traditional-Chinese", "Simplified-Chinese"], 

468 "漢語拼音": "Pinyin", 

469 "粵拼": "Jyutping", 

470 "現代標準漢語": "Standard-Chinese", 

471 "文言文": "Classical-Chinese", 

472 "官話白話文": "Written-vernacular-Chinese", 

473 "粵語": "Cantonese", 

474 "吳語": "Wu", 

475 "廣州話": "Cantonese", 

476 "臺灣華語": "Taiwanese-Mandarin", 

477} 

478 

479# classifier tags 

480# https://zh.wiktionary.org/wiki/Template:zh-mw 

481# https://zh.wiktionary.org/wiki/Module:Zh/templates 

482ZH_TAGS = { 

483 "官話": "Mandarin", 

484 "贛語": "Gan", 

485 "客家話": "Hakka", 

486 "晉語": "Jin", 

487 "閩北語": "Min-Bei", 

488 "閩東語": "Min-Dong", 

489 "閩南語": "Min-Nan", 

490 "潮州話": "Teochew", 

491 "湘語": "Xiang", 

492} 

493 

494# https://zh.wiktionary.org/wiki/Template:Zh-pron 

495# https://zh.wiktionary.org/wiki/Module:Zh-pron 

496ZH_PRON_TAGS = { 

497 "拼音": "Pinyin", 

498 "注音": "Bopomofo", 

499 "潮州話拼音": "Peng'im", 

500 "上海": "Shanghai", 

501 "吳語學堂拼音": "Wugniu", 

502 "通用拼音": "Tongyong-Pinyin", 

503 "威妥瑪拼音": "Wade–Giles", 

504 "耶魯官話拼音": "Yale", 

505 "國語羅馬字": "Gwoyeu-Romatsyh", 

506 "西里爾字母轉寫": "Cyrillic", 

507 "西里爾字母": "Cyrillic", 

508 "漢語國際音標": "Sinological-IPA", 

509 "耶魯粵拼": ["Yale", "Jyutping"], 

510 "廣州話拼音": ["Cantonese", "Pinyin"], 

511 "廣東拼音": "Guangdong-Romanization", 

512 "國際音標": "IPA", 

513 "模仿白話字": "POJ", 

514 "標準粵語": "Standard-Cantonese", 

515 "廣州–香港話": ["Guangzhou", "Hong Kong"], 

516 "福州話": "Fuzhou", 

517 "平話字": "Foochow-Romanized", 

518 "客家語": "Hakka", 

519 "白話字": "Phak-fa-su", 

520 "泉漳話": "Hokkien", 

521 "泉州": "Quanzhou", 

522 "廈門": "Xiamen", 

523 "輕尾聲異讀": "toneless-final-syllable-variant", 

524 "維基詞典": "Wiktionary-specific", 

525 "維基詞典拼音": ["Wiktionary-specific", "Pinyin"], 

526 "維基詞典轉寫": "Wiktionary-specific", 

527 "成都話": "Chengdu", 

528 "四川話拼音": ["Sichuanese", "Pinyin"], 

529 "東干語": "Dongan", 

530 "台山話": "Taishanese", 

531 "四縣": "Sixian", 

532 "長沙話": "Changsha", 

533 "四川話拉丁化新文字": "Latinxua-Sin-Wenz", 

534 "台城": "Taicheng", 

535 "南昌話": "Nanchang", 

536 "四縣話": "Sixian", 

537 "苗栗": "Miaoli", 

538 "美濃": "Neipu", 

539 "客家語拼音": "Hakka-Romanization-System", 

540 "客家話拼音方案": "Hagfa-Pinyim", 

541 "太原話": "Taiyuan", 

542 "老派": "dated", 

543 "新加坡": "Singapore", 

544 "臺羅": "Tâi-lô", 

545 "普實台文": "Phofsit-Daibuun", 

546 "太湖片": "Northern", 

547 "吳音小字典": "MiniDict", 

548 "維基詞典羅馬化": ["Wiktionary-specific", "romanization"], 

549 "上海話": "Shanghai", 

550 "中古漢語": "Middle-Chinese", 

551 "莆仙語": "Puxian-Min", 

552 "莆仙話拼音": "Pouseng-Ping'ing", 

553 "莆田": "Putian", 

554 "仙遊": "Xianyou", 

555 "漳州": "Zhangzhou", 

556 "臺北": "Taibei", 

557 "高雄": "Kaohsiung", 

558 "實際讀音": "phonetic", 

559 "臺灣話": "Taiwanese", 

560 "常用": "general", 

561 "檳城": "Penang", 

562 "兒化": "Erhua", 

563 "文讀": "literary", 

564 "中國大陸標準讀法": ["Mainland-China", "standard"], 

565 "臺灣異讀法": ["Taiwan", "variant"], 

566 "中國大陸與臺灣標準讀法": ["Mainland-China", "Taiwan", "standard"], 

567 "異讀": "variant", 

568 "上古": "Old-Chinese", 

569 "白–沙": "Baxter–Sagart", 

570 "鄭張": "Zhengzhang", 

571} 

572 

573ZH_DIAL_TAGS = { 

574 "白話文": "Written-vernacular-Chinese", 

575 "北京": "Beijing", 

576 "燕京官話": "Northeastern-Mandarin", 

577 "冀魯官話": "Jilu-Mandarin", 

578 "膠遼官話": "Jiaoliao-Mandarin", 

579 "中原官話": "Central-Plains-Mandarin", 

580 "蘭銀官話": "Lanyin-Mandarin", 

581 "西南官話": "Southwestern-Mandarin", 

582 "江淮官話": "Jianghuai-Mandarin", 

583 "徽語": "Huizhou", 

584 "南部平話": "Southern-Pinghua", 

585 "濟南": "Jinan", 

586 "臺灣": "Taiwan", 

587} 

588 

589TH_PRON_TAGS = { 

590 "寫法": "orthographic", 

591 "音素": "phoneme", 

592 "泰語羅馬化": "romanization", 

593 "派汶拼音": "Paiboon", 

594 "皇家轉寫": "Royal-Institute", 

595 "非正字法": "unorthographical", 

596 "短音": "short", 

597} 

598 

599 

600ALL_TAGS = { 

601 **GRAMMATICAL_TAGS, 

602 **LABEL_TAGS, 

603 **ZH_X_TAGS, 

604 **ZH_TAGS, 

605 **ZH_PRON_TAGS, 

606 **ZH_DIAL_TAGS, 

607 **TH_PRON_TAGS, 

608 # Template:vi-ipa 

609 "河內": "Hà-Nội", 

610 "順化": "Huế", 

611 "胡志明市": "Saigon", 

612 # Template:hi-ipa 

613 "德里": "Delhi", 

614 # Template:hi-noun 

615 "烏爾都文拼寫": "Urdu", 

616 # Template:sa-ipa 

617 "吠陀": "Vedic", 

618 "古典梵語": "Classical-Sanskrit", 

619} 

620 

621 

622def translate_raw_tags(data: WordEntry) -> WordEntry: 

623 raw_tags = [] 

624 for raw_tag in data.raw_tags: 

625 if raw_tag in ALL_TAGS: 

626 tr_tag = ALL_TAGS[raw_tag] 

627 if isinstance(tr_tag, str) and tr_tag not in data.tags: 

628 data.tags.append(tr_tag) 

629 elif isinstance(tr_tag, list): 

630 data.tags.extend(tr_tag) 

631 elif raw_tag in LABEL_TOPICS and hasattr(data, "topics"): 

632 data.topics.append(LABEL_TOPICS[raw_tag]) 

633 elif raw_tag not in raw_tags: 633 ↛ 624line 633 didn't jump to line 624 because the condition on line 633 was always true

634 raw_tags.append(raw_tag) 

635 data.raw_tags = raw_tags 

636 return data 

637 

638 

639# https://zh.wiktionary.org/wiki/Template:T 

640# https://zh.wiktionary.org/wiki/Template:Head 

641# https://zh.wiktionary.org/wiki/Module:Gender_and_number 

642TEMPLATE_TAG_ARGS = { 

643 "f": "feminine", 

644 "m": "masculine", 

645 "n": "neuter", 

646 "c": "common", 

647 # Animacy 

648 "an": "animate", 

649 "in": "inanimate", 

650 # Animal (for Ukrainian, Belarusian, Polish) 

651 "anml": "animal", 

652 # Personal (for Ukrainian, Belarusian, Polish) 

653 "pr": "personal", 

654 # Nonpersonal not currently used 

655 "np": "nonpersonal", 

656 # Virility (for Polish) 

657 "vr": "virile", 

658 "nv": "nonvirile", 

659 # Numbers 

660 "s": "singular number", 

661 "d": "dual number", 

662 "p": "plural number", 

663 # Verb qualifiers 

664 "impf": "imperfective", 

665 "pf": "perfective", 

666 "mf": ["masculine", "feminine"], 

667}