@kensio/pinyinjs 1.7.0 → 1.7.2

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.
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Words where CC-CEDICT's 轻声 sense is the everyday word and its full-tone
3
+ * sense is something else written the same way.
4
+ *
5
+ * Step 7 of the merge takes CC-CEDICT's neutral tones over the phrase corpus's
6
+ * full ones, and it does so against **the sense nearest the reading it already
7
+ * has** — otherwise 行长 would take 行's other pronunciation. That works for the
8
+ * 609 words it settles, and it cannot work here: the phrase corpus's reading
9
+ * matches the full-tone sense *exactly*, so the nearest sense is the one that
10
+ * already agrees and there is no neutral tone to take. 东西 is `dong1 xi1` (east
11
+ * and west) and `dong1 xi5` (thing), the corpus writes `dōng xī`, and the thing
12
+ * never got a say.
13
+ *
14
+ * **98 words are in that shape and nothing in the pipeline can rank two senses
15
+ * of one spelling.** jieba counts the spelling, not the sense. CPP labels 6 of
16
+ * the 98. Letting longer CC-CEDICT headwords vote, weighted by jieba, picks the
17
+ * *literal* sense for 东西 by 663 to 113 — because compounds like 东西半球 are
18
+ * exactly where a literal sense lives. So this is a list, and it is a list of
19
+ * judgements.
20
+ *
21
+ * **What is listed here.** A word whose 轻声 sense is the one 现代汉语词典 gives
22
+ * the headword, and whose full-tone sense is literary (生意 the life force),
23
+ * technical (说法 expounding the dharma), legal (告诉 filing a complaint) or a
24
+ * name (大方县, 金子 the Japanese surname). What is *not* listed is the larger
25
+ * half of the 98 where both senses are current and common — 地方 is `dìfang` the
26
+ * place and `dìfāng` the opposite of central, 大意 is the gist and carelessness,
27
+ * 多少 is how-many and an amount, 地道 is a tunnel and the real thing. Choosing
28
+ * for those would be trading one wrong answer for another.
29
+ *
30
+ * **No reading is written here**, only the word. The merge takes the neutral
31
+ * sense CC-CEDICT already holds, so a source refresh that changes a word's
32
+ * senses cannot leave a hand-typed reading behind — and `BUILD_ASSERTIONS`
33
+ * fails the build if any word here stops reading with a 轻声 at all.
34
+ */
35
+ export const NEUTRAL_SENSE_WORDS = [
36
+ { word: "东西", displaces: "east and west, the compass directions" },
37
+ { word: "告诉", displaces: "to press charges, the legal term" },
38
+ { word: "故事", displaces: "故事 gùshì, an old practice or precedent" },
39
+ { word: "妻子", displaces: "wife and children, the classical sense" },
40
+ { word: "说法", displaces: "to expound Buddhist teachings" },
41
+ { word: "小子", displaces: "CC-CEDICT's own (literary) and (old) youngster" },
42
+ { word: "买卖", displaces: "to buy and sell, the verb" },
43
+ { word: "生意", displaces: "life force, vitality" },
44
+ { word: "本事", displaces: "the source material a work is based on" },
45
+ { word: "大爷", displaces: "an arrogant idler, not one's uncle" },
46
+ { word: "大方", displaces: "大方县, the county in Guizhou" },
47
+ { word: "口音", displaces: "oral speech sounds, the linguistics term" },
48
+ { word: "结实", displaces: "to bear fruit" },
49
+ { word: "把手", displaces: "to shake hands, the verb" },
50
+ { word: "金子", displaces: "Kaneko, the Japanese surname" },
51
+ { word: "出息", displaces: "to yield interest, and to exhale in Buddhism" },
52
+ {
53
+ word: "管子",
54
+ displaces: "管子, the Warring States politician and the book",
55
+ },
56
+ { word: "支吾", displaces: "to resist, to withstand" },
57
+ ];
58
+ /**
59
+ * The listed words, for the merge to test membership against.
60
+ */
61
+ export const NEUTRAL_SENSE_LOOKUP = new Set(NEUTRAL_SENSE_WORDS.map((listed) => listed.word));
62
+ //# sourceMappingURL=neutral-senses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neutral-senses.js","sourceRoot":"","sources":["../../src/dictionary/neutral-senses.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAgC;IAC9D,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,uCAAuC,EAAE;IAClE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,kCAAkC,EAAE;IAC7D,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,wCAAwC,EAAE;IACnE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,wCAAwC,EAAE;IACnE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,+BAA+B,EAAE;IAC1D,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,gDAAgD,EAAE;IAC3E,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,2BAA2B,EAAE;IACtD,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,sBAAsB,EAAE;IACjD,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,wCAAwC,EAAE;IACnE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,oCAAoC,EAAE;IAC/D,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,4BAA4B,EAAE;IACvD,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,0CAA0C,EAAE;IACrE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE;IAC1C,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,0BAA0B,EAAE;IACrD,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,8BAA8B,EAAE;IACzD,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,8CAA8C,EAAE;IACzE;QACE,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,gDAAgD;KAC5D;IACD,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,yBAAyB,EAAE;CACrD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAC9D,mBAAmB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CACjD,CAAC"}
@@ -23,6 +23,12 @@ export interface ReadingOverride {
23
23
  * override is for the case where the sources agree with each other and are
24
24
  * still wrong, which is rare and almost always means a word whose everyday
25
25
  * sense has been displaced by an archaic one.
26
+ *
27
+ * A word CC-CEDICT reads *both* ways, where only the choice between its senses
28
+ * is wrong, belongs in
29
+ * {@link import("./neutral-senses.js").NEUTRAL_SENSE_WORDS} instead — that
30
+ * table names the word and lets CC-CEDICT supply the reading, so nothing is
31
+ * typed by hand that a source already holds.
26
32
  */
27
33
  export declare const READING_OVERRIDES: readonly ReadingOverride[];
28
34
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/dictionary/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGtE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAavD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,GACxB,SAAS,QAAQ,EAAE,CAqBrB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAMpE,CAAC"}
1
+ {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/dictionary/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGtE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAavD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,GACxB,SAAS,QAAQ,EAAE,CAqBrB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAMpE,CAAC"}
@@ -13,6 +13,12 @@ import { NEUTRAL_TONE } from "../tone/tone.js";
13
13
  * override is for the case where the sources agree with each other and are
14
14
  * still wrong, which is rare and almost always means a word whose everyday
15
15
  * sense has been displaced by an archaic one.
16
+ *
17
+ * A word CC-CEDICT reads *both* ways, where only the choice between its senses
18
+ * is wrong, belongs in
19
+ * {@link import("./neutral-senses.js").NEUTRAL_SENSE_WORDS} instead — that
20
+ * table names the word and lets CC-CEDICT supply the reading, so nothing is
21
+ * typed by hand that a source already holds.
16
22
  */
17
23
  export const READING_OVERRIDES = [
18
24
  {
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/dictionary/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAc/C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA+B;IAC3D;QACE,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,QAAQ;QACjB,MAAM,EACJ,+HAA+H;KAClI;IACD;QACE,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,OAAO;QAChB,MAAM,EACJ,+UAA+U;KAClV;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAyB;IAEzB,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO;SA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9B,CAAC,CACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kensio/pinyinjs",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Chinese hanzi to pinyin conversion",
5
5
  "repository": "https://github.com/KensioSoftware/pinyinjs",
6
6
  "homepage": "https://pinyinjs.dev",