@kensio/pinyinjs 1.9.9 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/NOTICE +7 -0
  2. package/README.md +27 -8
  3. package/data/core.entries +21 -21
  4. package/data/full.entries +17396 -17396
  5. package/data/manifest.json +9 -7
  6. package/data/standard.entries +3625 -3625
  7. package/dist/cli/lookup-commands.d.ts.map +1 -1
  8. package/dist/cli/lookup-commands.js +2 -44
  9. package/dist/cli/lookup-commands.js.map +1 -1
  10. package/dist/cli/lookup-entry.d.ts +12 -0
  11. package/dist/cli/lookup-entry.d.ts.map +1 -0
  12. package/dist/cli/lookup-entry.js +55 -0
  13. package/dist/cli/lookup-entry.js.map +1 -0
  14. package/dist/dictionary/artifact-format.d.ts +20 -1
  15. package/dist/dictionary/artifact-format.d.ts.map +1 -1
  16. package/dist/dictionary/artifact-format.js +37 -0
  17. package/dist/dictionary/artifact-format.js.map +1 -1
  18. package/dist/dictionary/artifact-read.d.ts.map +1 -1
  19. package/dist/dictionary/artifact-read.js +3 -7
  20. package/dist/dictionary/artifact-read.js.map +1 -1
  21. package/dist/dictionary/artifact.d.ts.map +1 -1
  22. package/dist/dictionary/artifact.js +2 -2
  23. package/dist/dictionary/artifact.js.map +1 -1
  24. package/dist/dictionary/build-assertions.d.ts.map +1 -1
  25. package/dist/dictionary/build-assertions.js +2 -0
  26. package/dist/dictionary/build-assertions.js.map +1 -1
  27. package/dist/dictionary/cedict-senses.d.ts +4 -3
  28. package/dist/dictionary/cedict-senses.d.ts.map +1 -1
  29. package/dist/dictionary/cedict-senses.js +7 -4
  30. package/dist/dictionary/cedict-senses.js.map +1 -1
  31. package/dist/dictionary/dictionary-entry.d.ts +8 -0
  32. package/dist/dictionary/dictionary-entry.d.ts.map +1 -1
  33. package/dist/dictionary/dictionary-entry.js +3 -1
  34. package/dist/dictionary/dictionary-entry.js.map +1 -1
  35. package/dist/dictionary/entry-invariants.d.ts +6 -0
  36. package/dist/dictionary/entry-invariants.d.ts.map +1 -1
  37. package/dist/dictionary/entry-invariants.js +0 -27
  38. package/dist/dictionary/entry-invariants.js.map +1 -1
  39. package/dist/dictionary/entry.d.ts +8 -0
  40. package/dist/dictionary/entry.d.ts.map +1 -1
  41. package/dist/dictionary/entry.js.map +1 -1
  42. package/dist/dictionary/locale-invariants.d.ts +3 -0
  43. package/dist/dictionary/locale-invariants.d.ts.map +1 -0
  44. package/dist/dictionary/locale-invariants.js +52 -0
  45. package/dist/dictionary/locale-invariants.js.map +1 -0
  46. package/dist/dictionary/locale.d.ts +5 -1
  47. package/dist/dictionary/locale.d.ts.map +1 -1
  48. package/dist/dictionary/locale.js +6 -1
  49. package/dist/dictionary/locale.js.map +1 -1
  50. package/dist/dictionary/merge-types.d.ts +10 -0
  51. package/dist/dictionary/merge-types.d.ts.map +1 -1
  52. package/dist/dictionary/merge-types.js +2 -0
  53. package/dist/dictionary/merge-types.js.map +1 -1
  54. package/dist/dictionary/merge-word.js +7 -6
  55. package/dist/dictionary/merge-word.js.map +1 -1
  56. package/dist/dictionary/merge.d.ts.map +1 -1
  57. package/dist/dictionary/merge.js +5 -1
  58. package/dist/dictionary/merge.js.map +1 -1
  59. package/dist/dictionary/standard-readings.d.ts +42 -0
  60. package/dist/dictionary/standard-readings.d.ts.map +1 -0
  61. package/dist/dictionary/standard-readings.js +113 -0
  62. package/dist/dictionary/standard-readings.js.map +1 -0
  63. package/dist/dictionary/taiwan-notes.d.ts +13 -0
  64. package/dist/dictionary/taiwan-notes.d.ts.map +1 -0
  65. package/dist/dictionary/taiwan-notes.js +26 -0
  66. package/dist/dictionary/taiwan-notes.js.map +1 -0
  67. package/dist/dictionary/taiwan-reading.d.ts +22 -2
  68. package/dist/dictionary/taiwan-reading.d.ts.map +1 -1
  69. package/dist/dictionary/taiwan-reading.js +94 -25
  70. package/dist/dictionary/taiwan-reading.js.map +1 -1
  71. package/dist/dictionary/taiwan-settle.d.ts +22 -0
  72. package/dist/dictionary/taiwan-settle.d.ts.map +1 -0
  73. package/dist/dictionary/taiwan-settle.js +47 -0
  74. package/dist/dictionary/taiwan-settle.js.map +1 -0
  75. package/dist/search/match-readings.d.ts +2 -2
  76. package/dist/search/match-readings.d.ts.map +1 -1
  77. package/dist/search/match-readings.js +12 -7
  78. package/dist/search/match-readings.js.map +1 -1
  79. package/dist/sources/moe-workbook.d.ts +10 -0
  80. package/dist/sources/moe-workbook.d.ts.map +1 -0
  81. package/dist/sources/moe-workbook.js +89 -0
  82. package/dist/sources/moe-workbook.js.map +1 -0
  83. package/dist/sources/moe.d.ts +58 -0
  84. package/dist/sources/moe.d.ts.map +1 -0
  85. package/dist/sources/moe.js +79 -0
  86. package/dist/sources/moe.js.map +1 -0
  87. package/dist/sources/xlsx.d.ts +20 -0
  88. package/dist/sources/xlsx.d.ts.map +1 -0
  89. package/dist/sources/xlsx.js +78 -0
  90. package/dist/sources/xlsx.js.map +1 -0
  91. package/package.json +1 -1
package/NOTICE CHANGED
@@ -41,6 +41,13 @@ Source: https://raw.githubusercontent.com/BYVoid/OpenCC/master/data/dictionary
41
41
  Licence: Apache-2.0
42
42
  Provides: the 简体 ↔ 繁體 character tables, and the Taiwan and Hong Kong glyph form tables that separate 裡 from 裏 and 群 from 羣
43
43
 
44
+ ## 中華民國教育部(Ministry of Education, R.O.C.)。《國語辭典簡編本》(版本編號:2014_20260929)網址:https://dict.concised.moe.edu.tw/ and 《重編國語辭典修訂本》(版本編號:2015_20260929)網址:https://dict.revised.moe.edu.tw/
45
+
46
+ Source: https://language.moe.gov.tw/001/Upload/Files/site_content/M0001/respub/download/dict_concised_2014_20260929.zip
47
+ https://language.moe.gov.tw/001/Upload/Files/site_content/M0001/respub/download/dict_revised_2015_20260929.zip
48
+ Licence: CC BY-ND 3.0 TW; only the 漢語拼音 reading of each headword is read, and no definition, example or other text of either dictionary is taken
49
+ Provides: the 國語 readings that make up the zh-TW locale, at word level and as a check on the character-level notes
50
+
44
51
  ## Comparison of Standard Chinese transcription systems (Wikipedia)
45
52
 
46
53
  Source: https://en.wikipedia.org/wiki/Comparison_of_Standard_Chinese_transcription_systems
package/README.md CHANGED
@@ -47,6 +47,7 @@ $ pinyinjs explain 银行
47
47
 
48
48
  $ pinyinjs lookup 头发
49
49
  头发 tóu fa n
50
+ zh-TW tóu fǎ
50
51
 
51
52
  $ pinyinjs match --query bjdx 北京大学 我在北京大学学中文 上海大学
52
53
  [北京大学] 7.00
@@ -812,6 +813,21 @@ Both scripts are dictionary keys, so only the locale is an option to pass. Hong
812
813
  Kong's 繁體 forms are recognised on the way in, so 羣眾 and 麪包 read exactly as
813
814
  群眾 and 麵包 do.
814
815
 
816
+ `zh-TW` reads words as the Taiwan Ministry of Education's dictionaries of the
817
+ 國語 standard do, for every word they list. A word with no Taiwan reading is
818
+ read the same in both locales.
819
+
820
+ ```ts
821
+ convert(dictionary, "星期", { locale: "zh-TW" }); // "xīngqí"
822
+ convert(dictionary, "頭髮", { locale: "zh-TW" }); // "tóufǎ"
823
+ convert(dictionary, "他和我", { locale: "zh-TW" }); // "tā hé wǒ"
824
+ ```
825
+
826
+ A Taiwan reading that holds for one sense only stays out of the default. 和 is
827
+ `hé` in both locales, and `lookup` lists the `hàn` of the conjunction as
828
+ `taiwanAlternates`. Hong Kong teaches Putonghua to the mainland's readings, so
829
+ Hong Kong text takes `zh-CN`. See [scripts and locales](docs/scripts-and-locales/#the-locale-delta).
830
+
815
831
  ## Simplified and traditional
816
832
 
817
833
  `toScript` converts between the scripts, and the reading is what makes it
@@ -905,7 +921,7 @@ Every example in this README is executed by `src/readme.test.ts` against the
905
921
  committed dictionary, so the two cannot drift apart. Change them together.
906
922
 
907
923
  The compiled dictionaries in `data/` are committed, so what ships is exactly
908
- what was tested. `pnpm build:data` fetches the four sources into `.cache/` (~32
924
+ what was tested. `pnpm build:data` fetches the sources into `.cache/` (~41
909
925
  MB), merges them, runs the build assertions, and rewrites `data/` and `NOTICE`.
910
926
  It fails where it could warn. No artifact is written unless 儿化 is repaired
911
927
  both ways, 一 and 不 sandhi is normalised out, every syllable is one the
@@ -913,12 +929,13 @@ inventory knows, and every tier reads back exactly as it was built.
913
929
 
914
930
  ## Data sources
915
931
 
916
- | Source | Provides | Licence |
917
- | --------------------------------------------------------------------- | ----------------------------------------------------- | ------------ |
918
- | [Unihan](https://www.unicode.org/charts/unihan.html) | character readings, polyphone priors, script variants | Unicode |
919
- | [CC-CEDICT](https://www.mdbg.net/chinese/dictionary?page=cc-cedict) | 简体/繁體 pairs, 儿化, neutral tones, Taiwan readings | CC BY-SA 4.0 |
920
- | [phrase-pinyin-data](https://github.com/mozillazg/phrase-pinyin-data) | the bulk of the word readings | MIT |
921
- | [jieba](https://github.com/fxsjy/jieba) | word frequencies and part-of-speech tags | MIT |
932
+ | Source | Provides | Licence |
933
+ | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | --------------- |
934
+ | [Unihan](https://www.unicode.org/charts/unihan.html) | character readings, polyphone priors, script variants | Unicode |
935
+ | [CC-CEDICT](https://www.mdbg.net/chinese/dictionary?page=cc-cedict) | 简体/繁體 pairs, 儿化, neutral tones, Taiwan readings | CC BY-SA 4.0 |
936
+ | [phrase-pinyin-data](https://github.com/mozillazg/phrase-pinyin-data) | the bulk of the word readings | MIT |
937
+ | [jieba](https://github.com/fxsjy/jieba) | word frequencies and part-of-speech tags | MIT |
938
+ | [教育部 國語辭典](https://language.moe.gov.tw/001/Upload/Files/site_content/M0001/respub/index.html) | Taiwan (國語) readings, as reading facts only | CC BY-ND 3.0 TW |
922
939
 
923
940
  `NOTICE` is generated from the same table the pipeline fetches from.
924
941
 
@@ -926,5 +943,7 @@ inventory knows, and every tier reads back exactly as it was built.
926
943
 
927
944
  `Apache-2.0 AND CC-BY-SA-4.0`, because the package is two things. The code is
928
945
  Apache-2.0, and the compiled dictionaries in `data/` are share-alike, CC-CEDICT
929
- being CC BY-SA 4.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE), which is
946
+ being CC BY-SA 4.0. The Taiwan readings are taken from the Ministry of
947
+ Education's dictionaries as facts about how each word is read. No definition or
948
+ other text of those dictionaries is in `data/`. See [LICENSE](LICENSE) and [NOTICE](NOTICE), which is
930
949
  generated from the sources the pipeline actually fetched.
package/data/core.entries CHANGED
@@ -262,7 +262,7 @@ jin1 zg
262
262
  jie4 nr
263
263
  bing1 zg
264
264
  reng2 zg
265
- cong2 p cong1
265
+ cong2 ,zong4 p cong1
266
266
  san3 zg
267
267
  lun2 g
268
268
  cang1 nr
@@ -328,7 +328,7 @@ tang3 zg
328
328
  zhong4 ng
329
329
  you1 n
330
330
  huo3 n huo5
331
- hui4 v kuai4
331
+ hui4 ,hui3 v kuai4
332
332
  yu3 v
333
333
  yun2 zg
334
334
  san3 n
@@ -473,7 +473,7 @@ bian4 d pian2
473
473
  yu3 x
474
474
  xi4 zg
475
475
  cu4 v
476
- e2 e4 j
476
+ e2 j
477
477
  qiu2 x
478
478
  xu2
479
479
  guang4 zg
@@ -1110,7 +1110,7 @@ shao4 g
1110
1110
  zhu1 zg
1111
1111
  li4 nr
1112
1112
  jin4 n jing4
1113
- lao2 vn
1113
+ lao2 ,lao4 vn
1114
1114
  juan4 zg
1115
1115
  kou3
1116
1116
  wa1 zg
@@ -1212,7 +1212,7 @@ suan3 zg
1212
1212
  du2
1213
1213
  jiu4
1214
1214
  jue2
1215
- pi3 q
1215
+ pi3 ,pi1 q
1216
1216
  qu1 n ou1
1217
1217
  yi1 n
1218
1218
  ke1 zg
@@ -1435,7 +1435,7 @@ dun1 dun4 m
1435
1435
  fen1 v
1436
1436
  e2
1437
1437
  han2 v
1438
- ting1 v ting5
1438
+ ting1 ,ting4 v ting5
1439
1439
  keng1 zg hang2
1440
1440
  shun3 v
1441
1441
  qi3 v
@@ -1519,7 +1519,7 @@ fu2
1519
1519
  yang1
1520
1520
  he2
1521
1521
  ze2 r zha1,za3
1522
- he2 han4 c huo5,he4,hu2,huo2,huo4,he5
1522
+ he2 ,han4 c huo5,he4,hu2,huo2,huo4,he5
1523
1523
  hai1 zg
1524
1524
  jiu4 ng
1525
1525
  yong3 n
@@ -2069,7 +2069,7 @@ gui1 ns
2069
2069
  pi3 zg
2070
2070
  yi2 g
2071
2071
  de5 uv di4
2072
- zhen4 zun4 nt
2072
+ zhen4 ,zun4 nt
2073
2073
  xia4 zg
2074
2074
  kuang4 ng
2075
2075
  chang3 q chang2
@@ -2464,7 +2464,7 @@ wai4 f
2464
2464
  yuan4
2465
2465
  mao3
2466
2466
  su4 n
2467
- duo1 m
2467
+ duo1 ,duo2 m
2468
2468
  duo1 zg
2469
2469
  ye4 t
2470
2470
  gou4 zg
@@ -4537,7 +4537,7 @@ yang1
4537
4537
  bao4 v
4538
4538
  ni3
4539
4539
  ye4 zg
4540
- di3 zg
4540
+ di3 ,zhi3 zg
4541
4541
  chi4
4542
4542
  mo3 v ma1,mo4
4543
4543
  mei4 zg
@@ -5558,7 +5558,7 @@ xi1 vg
5558
5558
  hu4
5559
5559
  ya1 zg
5560
5560
  dou3 zg
5561
- zhen3 n
5561
+ zhen3 ,zhen4 n
5562
5562
  yao1 zg
5563
5563
  lin2 ng
5564
5564
  rui4 zg
@@ -6428,7 +6428,7 @@ ai3 zg
6428
6428
  jie3
6429
6429
  du2 zg
6430
6430
  yu4 nz
6431
- bi3 p
6431
+ bi3 ,bi4 p
6432
6432
  bi4 v
6433
6433
  bi4 g
6434
6434
  pi2 zg
@@ -6641,7 +6641,7 @@ you1 zg
6641
6641
  gu1 zg
6642
6642
  hong2 q
6643
6643
  gan1 n
6644
- fa3 fa4 j fa5
6644
+ fa3 j fa5
6645
6645
  mao3 g
6646
6646
  si4 ns
6647
6647
  ping2
@@ -7619,7 +7619,7 @@ jing5 zg
7619
7619
  ying2 n
7620
7620
  yu4 ag
7621
7621
  tai4
7622
- zao4 ag
7622
+ zao4 ,sao4 ag
7623
7623
  can4 a
7624
7624
  sui4 n
7625
7625
  zong3 zg
@@ -7980,7 +7980,7 @@ fen1 x bin1
7980
7980
  yue4 zg
7981
7981
  jue2 zg
7982
7982
  jue2 g
7983
- wan2 v
7983
+ wan2 ,wan4 v
7984
7984
  jian1 zg
7985
7985
  mei2 n
7986
7986
  pin2
@@ -10233,7 +10233,7 @@ sha1 zg
10233
10233
  gang1 n
10234
10234
  na4 nr
10235
10235
  ren4
10236
- zong4 zong1 n
10236
+ zong4 ,zong1 n
10237
10237
  lun2 x guan1
10238
10238
  fen1 d
10239
10239
  zhi3 n
@@ -10410,7 +10410,7 @@ zhi4 v zhi5
10410
10410
  an3
10411
10411
  fa2
10412
10412
  lan3 v
10413
- shu3 ng
10413
+ shu3 ,shu4 ng
10414
10414
  si1
10415
10415
  pi2 g
10416
10416
  ma4 v
@@ -10689,7 +10689,7 @@ zhen1 g
10689
10689
  zuo4 g
10690
10690
  pei1 n
10691
10691
  jia3 zg
10692
- sheng4 v sheng1
10692
+ sheng4 ,sheng1 v sheng1
10693
10693
  zhi1 x
10694
10694
  bao1 n
10695
10695
  qu1 zg
@@ -12162,7 +12162,7 @@ er4
12162
12162
  ka1
12163
12163
  mie4
12164
12164
  xi4
12165
- xing2 zg hang2,heng2,hang4
12165
+ xing2 ,xing4 zg hang2,heng2,hang4
12166
12166
  yan3 v
12167
12167
  kan4 zg
12168
12168
  yuan4 zg
@@ -13655,7 +13655,7 @@ yuan2 n
13655
13655
  xia2 v
13656
13656
  zhan3 v nian3
13657
13657
  lu4 n
13658
- zhe2 che4 n
13658
+ zhe2 ,che4 n
13659
13659
  lin2 x
13660
13660
  xin1 nr p
13661
13661
  gu1 nr p
@@ -14640,7 +14640,7 @@ yu4 g
14640
14640
  qian2 n qian5
14641
14641
  zheng1 g
14642
14642
  qian2 n
14643
- gu3 gu1 ng
14643
+ gu3 ,gu1 ng
14644
14644
  bo1 ng
14645
14645
  ke1 zg
14646
14646
  po3 g