@kensio/pinyinjs 1.7.8 → 1.7.9
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.
- package/README.md +18 -2
- package/data/core.entries +2259 -2259
- package/data/core.freq +0 -0
- package/data/full.counts +0 -0
- package/data/full.entries +2289 -2289
- package/data/full.freq +0 -0
- package/data/manifest.json +8 -8
- package/data/standard.entries +2257 -2257
- package/data/standard.freq +0 -0
- package/dist/cli/flag-lists.d.ts +2 -1
- package/dist/cli/flag-lists.d.ts.map +1 -1
- package/dist/cli/flag-lists.js.map +1 -1
- package/dist/cli/format-options.d.ts +5 -1
- package/dist/cli/format-options.d.ts.map +1 -1
- package/dist/cli/format-options.js +9 -2
- package/dist/cli/format-options.js.map +1 -1
- package/dist/cli/html-commands.d.ts.map +1 -1
- package/dist/cli/html-commands.js +15 -3
- package/dist/cli/html-commands.js.map +1 -1
- package/dist/cli/systems.d.ts +15 -43
- package/dist/cli/systems.d.ts.map +1 -1
- package/dist/cli/systems.js +9 -12
- package/dist/cli/systems.js.map +1 -1
- package/dist/decode/guo-rule.d.ts +64 -0
- package/dist/decode/guo-rule.d.ts.map +1 -0
- package/dist/decode/guo-rule.js +138 -0
- package/dist/decode/guo-rule.js.map +1 -0
- package/dist/decode/reading-rules.d.ts +1 -0
- package/dist/decode/reading-rules.d.ts.map +1 -1
- package/dist/decode/reading-rules.js +3 -0
- package/dist/decode/reading-rules.js.map +1 -1
- package/dist/dictionary/frequency-table.d.ts +46 -0
- package/dist/dictionary/frequency-table.d.ts.map +1 -1
- package/dist/dictionary/frequency-table.js +37 -8
- package/dist/dictionary/frequency-table.js.map +1 -1
- package/dist/dictionary/merge-types.d.ts +12 -0
- package/dist/dictionary/merge-types.d.ts.map +1 -1
- package/dist/dictionary/merge-types.js.map +1 -1
- package/dist/dictionary/merge-word.d.ts.map +1 -1
- package/dist/dictionary/merge-word.js +2 -2
- package/dist/dictionary/merge-word.js.map +1 -1
- package/dist/dictionary/merge.d.ts.map +1 -1
- package/dist/dictionary/merge.js +11 -1
- package/dist/dictionary/merge.js.map +1 -1
- package/dist/dictionary/name-mass.d.ts +42 -0
- package/dist/dictionary/name-mass.d.ts.map +1 -0
- package/dist/dictionary/name-mass.js +66 -0
- package/dist/dictionary/name-mass.js.map +1 -0
- package/dist/dictionary/proper-noun.d.ts +8 -1
- package/dist/dictionary/proper-noun.d.ts.map +1 -1
- package/dist/dictionary/proper-noun.js +13 -3
- package/dist/dictionary/proper-noun.js.map +1 -1
- package/dist/dictionary/script-pairings.d.ts +12 -0
- package/dist/dictionary/script-pairings.d.ts.map +1 -1
- package/dist/dictionary/script-pairings.js +20 -0
- package/dist/dictionary/script-pairings.js.map +1 -1
- package/dist/dictionary/traditional-carry.d.ts +23 -0
- package/dist/dictionary/traditional-carry.d.ts.map +1 -0
- package/dist/dictionary/traditional-carry.js +201 -0
- package/dist/dictionary/traditional-carry.js.map +1 -0
- package/dist/format/annotate.d.ts.map +1 -1
- package/dist/format/annotate.js +3 -3
- package/dist/format/annotate.js.map +1 -1
- package/dist/format/html.d.ts +41 -6
- package/dist/format/html.d.ts.map +1 -1
- package/dist/format/html.js +34 -83
- package/dist/format/html.js.map +1 -1
- package/dist/format/language-tag.d.ts +57 -0
- package/dist/format/language-tag.d.ts.map +1 -0
- package/dist/format/language-tag.js +76 -0
- package/dist/format/language-tag.js.map +1 -0
- package/dist/format/syllable-span.d.ts +10 -0
- package/dist/format/syllable-span.d.ts.map +1 -0
- package/dist/format/syllable-span.js +87 -0
- package/dist/format/syllable-span.js.map +1 -0
- package/dist/format/transcribed.d.ts +36 -0
- package/dist/format/transcribed.d.ts.map +1 -0
- package/dist/format/transcribed.js +38 -0
- package/dist/format/transcribed.js.map +1 -0
- package/dist/format/transcription.d.ts.map +1 -1
- package/dist/format/transcription.js +7 -19
- package/dist/format/transcription.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/transcription/systems.d.ts +82 -0
- package/dist/transcription/systems.d.ts.map +1 -0
- package/dist/transcription/systems.js +64 -0
- package/dist/transcription/systems.js.map +1 -0
- package/package.json +1 -1
- package/dist/cli/system-table.d.ts +0 -12
- package/dist/cli/system-table.d.ts.map +0 -1
- package/dist/cli/system-table.js +0 -48
- package/dist/cli/system-table.js.map +0 -1
package/data/standard.freq
CHANGED
|
Binary file
|
package/dist/cli/flag-lists.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type { CapitalStyle } from "../orthography/capitals.js";
|
|
|
18
18
|
import type { PunctuationStyle } from "../orthography/punctuation.js";
|
|
19
19
|
import type { Locale } from "../script/script.js";
|
|
20
20
|
import type { ToneNotation } from "../syllable/syllable.js";
|
|
21
|
+
import type { TranscriptionSystemName } from "../transcription/systems.js";
|
|
21
22
|
import type { FlagName, Flags } from "./flags.js";
|
|
22
23
|
/**
|
|
23
24
|
* Read a flag that takes a value, checking it against what the library accepts.
|
|
@@ -44,6 +45,6 @@ export declare const TIERS: readonly Tier[];
|
|
|
44
45
|
* `chi` is a well-formed spelling in both pinyin and Wade-Giles and means
|
|
45
46
|
* different syllables in each.
|
|
46
47
|
*/
|
|
47
|
-
export type TranscriptionSource = "auto" | "pinyin" |
|
|
48
|
+
export type TranscriptionSource = "auto" | "pinyin" | TranscriptionSystemName;
|
|
48
49
|
export declare const SOURCES: readonly TranscriptionSource[];
|
|
49
50
|
//# sourceMappingURL=flag-lists.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flag-lists.d.ts","sourceRoot":"","sources":["../../src/cli/flag-lists.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,e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EpE,eAAO,MAAM,cAAc,EAAE,SAAS,aAAa,EAAyB,CAAC;AAE7E,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAAe,CAAC;AAE9D,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAAiC,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,uBAAuB,CAAC;AAE9E,eAAO,MAAM,OAAO,EAAE,SAAS,mBAAmB,EAQjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flag-lists.js","sourceRoot":"","sources":["../../src/cli/flag-lists.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flag-lists.js","sourceRoot":"","sources":["../../src/cli/flag-lists.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,MAAM,CACpB,KAAY,EACZ,IAAc,EACd,OAAyB;IAEzB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;IAC/D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,UAAU,CAClB,KAAK,IAAI,mBAAmB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAA4B;IAChD,OAAO;IACP,SAAS;IACT,aAAa;IACb,MAAM;CACP,CAAC;AAE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,KAAK;CACN,CAAC"}
|
|
@@ -12,7 +12,11 @@ export { colourDepth, type TranscriptionSource, transcriptionSource, transcripti
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function slugOptions(flags: Flags): SlugOptions;
|
|
14
14
|
/**
|
|
15
|
-
* The same, plus the
|
|
15
|
+
* The same, plus the four flags that only mean anything in HTML.
|
|
16
|
+
*
|
|
17
|
+
* `--system` is one of them here as well as on `convert`, and it means the same
|
|
18
|
+
* thing: write the reading in that system rather than in pinyin. A name no
|
|
19
|
+
* system answers to leaves the option off, which is the pinyin default.
|
|
16
20
|
*/
|
|
17
21
|
export declare function htmlOptions(flags: Flags): HtmlOptions;
|
|
18
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-options.d.ts","sourceRoot":"","sources":["../../src/cli/format-options.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"format-options.d.ts","sourceRoot":"","sources":["../../src/cli/format-options.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAYxC,OAAO,EACL,WAAW,EACX,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CA4BrD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CASrD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAE3D"}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import { convertOptions } from "./options.js";
|
|
8
8
|
import { SCRIPT_TARGETS } from "../decode/script.js";
|
|
9
9
|
import { SCRIPTS } from "../script/script.js";
|
|
10
|
-
import { chosen, counted, LOCALES, SLUG_SYLLABLES, SLUG_TONES, SLUG_UMLAUTS, } from "./flag-values.js";
|
|
10
|
+
import { chosen, counted, LOCALES, SLUG_SYLLABLES, SLUG_TONES, SLUG_UMLAUTS, transcriptionSystem as systemFlag, } from "./flag-values.js";
|
|
11
|
+
import { systemNamed } from "./systems.js";
|
|
11
12
|
export { colourDepth, transcriptionSource, transcriptionSystem, } from "./flag-values.js";
|
|
12
13
|
/**
|
|
13
14
|
* Turn the slug flags into the options the library takes.
|
|
@@ -44,14 +45,20 @@ export function slugOptions(flags) {
|
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
|
-
* The same, plus the
|
|
48
|
+
* The same, plus the four flags that only mean anything in HTML.
|
|
49
|
+
*
|
|
50
|
+
* `--system` is one of them here as well as on `convert`, and it means the same
|
|
51
|
+
* thing: write the reading in that system rather than in pinyin. A name no
|
|
52
|
+
* system answers to leaves the option off, which is the pinyin default.
|
|
48
53
|
*/
|
|
49
54
|
export function htmlOptions(flags) {
|
|
55
|
+
const system = systemNamed(systemFlag(flags));
|
|
50
56
|
return {
|
|
51
57
|
...convertOptions(flags),
|
|
52
58
|
...(flags["no-tone-classes"] === true && { toneClasses: false }),
|
|
53
59
|
...(flags["no-uncertain"] === true && { markUncertain: false }),
|
|
54
60
|
...(flags["no-lang"] === true && { lang: false }),
|
|
61
|
+
...(system !== undefined && { transcription: system }),
|
|
55
62
|
};
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-options.js","sourceRoot":"","sources":["../../src/cli/format-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAqB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGxE,OAAO,EAAe,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,
|
|
1
|
+
{"version":3,"file":"format-options.js","sourceRoot":"","sources":["../../src/cli/format-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAqB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGxE,OAAO,EAAe,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,mBAAmB,IAAI,UAAU,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EACL,WAAW,EAEX,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,MAAM,MAAM,GAAG;QACb,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,EAAE,KAA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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-commands.d.ts","sourceRoot":"","sources":["../../src/cli/html-commands.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,cAAc,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"html-commands.d.ts","sourceRoot":"","sources":["../../src/cli/html-commands.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,cAAc,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,OAmBlB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,OAmBtB,CAAC"}
|
|
@@ -16,7 +16,13 @@ export const HTML = {
|
|
|
16
16
|
name: "html",
|
|
17
17
|
summary: "hanzi to pinyin as HTML, one element per syllable",
|
|
18
18
|
argument: "[text...]",
|
|
19
|
-
flags: [
|
|
19
|
+
flags: [
|
|
20
|
+
...CONVERT_FLAGS,
|
|
21
|
+
"no-tone-classes",
|
|
22
|
+
"no-uncertain",
|
|
23
|
+
"no-lang",
|
|
24
|
+
"system",
|
|
25
|
+
],
|
|
20
26
|
needsDictionary: true,
|
|
21
27
|
run: (input) => {
|
|
22
28
|
const options = htmlOptions(input.flags);
|
|
@@ -34,9 +40,15 @@ export const HTML = {
|
|
|
34
40
|
*/
|
|
35
41
|
export const ANNOTATE = {
|
|
36
42
|
name: "annotate",
|
|
37
|
-
summary: "hanzi with its
|
|
43
|
+
summary: "hanzi with its reading above, as ruby HTML",
|
|
38
44
|
argument: "[text...]",
|
|
39
|
-
flags: [
|
|
45
|
+
flags: [
|
|
46
|
+
...CONVERT_FLAGS,
|
|
47
|
+
"no-tone-classes",
|
|
48
|
+
"no-uncertain",
|
|
49
|
+
"no-lang",
|
|
50
|
+
"system",
|
|
51
|
+
],
|
|
40
52
|
needsDictionary: true,
|
|
41
53
|
run: (input) => {
|
|
42
54
|
const options = htmlOptions(input.flags);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-commands.js","sourceRoot":"","sources":["../../src/cli/html-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAgB,YAAY,EAAE,MAAM,cAAc,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,mDAAmD;IAC5D,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"html-commands.js","sourceRoot":"","sources":["../../src/cli/html-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAgB,YAAY,EAAE,MAAM,cAAc,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,mDAAmD;IAC5D,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE;QACL,GAAG,aAAa;QAChB,iBAAiB;QACjB,cAAc;QACd,SAAS;QACT,QAAQ;KACT;IACD,eAAe,EAAE,IAAI;IACrB,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9B,MAAM,IAAI,GAAG,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YAC/D,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAY;IAC/B,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,4CAA4C;IACrD,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE;QACL,GAAG,aAAa;QAChB,iBAAiB;QACjB,cAAc;QACd,SAAS;QACT,QAAQ;KACT;IACD,eAAe,EAAE,IAAI;IACrB,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9B,MAAM,IAAI,GAAG,sBAAsB,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACxE,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
package/dist/cli/systems.d.ts
CHANGED
|
@@ -1,57 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The systems table, and the one thing the CLI does with it that nothing else
|
|
3
|
+
* does, which is to paint every syllable of a word its own colour.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `commands.test.ts` holds the pair together over the whole inventory.
|
|
5
|
+
* The table itself is `src/transcription/systems.ts`, since what a system
|
|
6
|
+
* writes is a fact about the system rather than about a terminal.
|
|
7
7
|
*/
|
|
8
8
|
import type { Syllable } from "../syllable/syllable.js";
|
|
9
|
-
|
|
10
|
-
import type { TranscriptionSource } from "./
|
|
9
|
+
import { type TranscriptionSystem } from "../transcription/systems.js";
|
|
10
|
+
import type { TranscriptionSource } from "./flag-lists.js";
|
|
11
11
|
import type { Painter } from "./colour.js";
|
|
12
|
+
export { BOPOMOFO, GWOYEU, IPA, WADE_GILES, YALE, } from "../transcription/systems.js";
|
|
13
|
+
export type { TranscriptionSystem as System } from "../transcription/systems.js";
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* The `write*Word` helpers are each a map and a join, and this takes them apart
|
|
16
|
-
* so that every syllable can be painted its own colour. That duplicates five
|
|
17
|
-
* separators, so each entry carries the helper it stands in for and
|
|
18
|
-
* `commands.test.ts` asserts the two agree over the whole inventory in every
|
|
19
|
-
* tone state — rather than the list being trusted.
|
|
20
|
-
*/
|
|
21
|
-
export interface System {
|
|
22
|
-
/** What `--from` and `--system` call it. */
|
|
23
|
-
readonly name: TranscriptionSource;
|
|
24
|
-
readonly write: (syllable: Syllable) => string;
|
|
25
|
-
readonly separator: string;
|
|
26
|
-
/**
|
|
27
|
-
* How the system writes a word, with its tones or without them.
|
|
28
|
-
*
|
|
29
|
-
* `--notation none` can only be honoured where the tone is written
|
|
30
|
-
* separately*: Wade-Giles, Yale and IPA all have a way to leave it off.
|
|
31
|
-
* Bopomofo marks it with a symbol of the script and Gwoyeu Romatzyh spells
|
|
32
|
-
* it into the syllable, so for those two there is nothing to leave off and
|
|
33
|
-
* the flag is ignored rather than approximated.
|
|
34
|
-
*/
|
|
35
|
-
readonly word: (syllables: readonly Syllable[], hasTones: boolean) => string;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the system writes the capitals the conversion settled.
|
|
38
|
-
*
|
|
39
|
-
* The three romanisations do, since a romanisation is a way of writing
|
|
40
|
-
* Chinese in the Latin alphabet and inherits what that alphabet does with a
|
|
41
|
-
* proper noun. IPA and bopomofo do not — see {@link toTranscription}.
|
|
42
|
-
*/
|
|
43
|
-
readonly capitals: boolean;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Every system `transcribe` writes a column for, for the guard above.
|
|
15
|
+
* Every system `transcribe` writes a column for.
|
|
47
16
|
*/
|
|
48
|
-
export declare const SYSTEMS: readonly
|
|
17
|
+
export declare const SYSTEMS: readonly TranscriptionSystem[];
|
|
49
18
|
/**
|
|
50
19
|
* The system a `--system` or `--from` name stands for.
|
|
20
|
+
*
|
|
21
|
+
* `auto` and `pinyin` are names the flags take and no system answers to, so
|
|
22
|
+
* both come back undefined.
|
|
51
23
|
*/
|
|
52
|
-
export declare function systemNamed(name: TranscriptionSource | undefined):
|
|
24
|
+
export declare function systemNamed(name: TranscriptionSource | undefined): TranscriptionSystem | undefined;
|
|
53
25
|
/**
|
|
54
26
|
* Write a run of syllables in one system, each syllable in its tone's colour.
|
|
55
27
|
*/
|
|
56
|
-
export declare function writtenWith(syllables: readonly Syllable[], system:
|
|
28
|
+
export declare function writtenWith(syllables: readonly Syllable[], system: TranscriptionSystem, paint: Painter): string;
|
|
57
29
|
//# sourceMappingURL=systems.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systems.d.ts","sourceRoot":"","sources":["../../src/cli/systems.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"systems.d.ts","sourceRoot":"","sources":["../../src/cli/systems.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,UAAU,EACV,IAAI,GACL,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,mBAAmB,IAAI,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,mBAAmB,EAA0B,CAAC;AAE7E;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,mBAAmB,GAAG,SAAS,GACpC,mBAAmB,GAAG,SAAS,CAEjC;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,SAAS,QAAQ,EAAE,EAC9B,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,OAAO,GACb,MAAM,CAIR"}
|
package/dist/cli/systems.js
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { TRANSCRIPTION_SYSTEMS, transcriptionSystemNamed, } from "../transcription/systems.js";
|
|
2
|
+
export { BOPOMOFO, GWOYEU, IPA, WADE_GILES, YALE, } from "../transcription/systems.js";
|
|
3
3
|
/**
|
|
4
|
-
* Every system `transcribe` writes a column for
|
|
4
|
+
* Every system `transcribe` writes a column for.
|
|
5
5
|
*/
|
|
6
|
-
export const SYSTEMS =
|
|
7
|
-
BOPOMOFO,
|
|
8
|
-
WADE_GILES,
|
|
9
|
-
YALE,
|
|
10
|
-
GWOYEU,
|
|
11
|
-
IPA,
|
|
12
|
-
];
|
|
6
|
+
export const SYSTEMS = TRANSCRIPTION_SYSTEMS;
|
|
13
7
|
/**
|
|
14
8
|
* The system a `--system` or `--from` name stands for.
|
|
9
|
+
*
|
|
10
|
+
* `auto` and `pinyin` are names the flags take and no system answers to, so
|
|
11
|
+
* both come back undefined.
|
|
15
12
|
*/
|
|
16
13
|
export function systemNamed(name) {
|
|
17
|
-
return
|
|
14
|
+
return transcriptionSystemNamed(name);
|
|
18
15
|
}
|
|
19
16
|
/**
|
|
20
17
|
* Write a run of syllables in one system, each syllable in its tone's colour.
|
|
21
18
|
*/
|
|
22
19
|
export function writtenWith(syllables, system, paint) {
|
|
23
20
|
return syllables
|
|
24
|
-
.map((syllable) => paint(system.write(syllable), syllable.tone))
|
|
21
|
+
.map((syllable) => paint(system.write(syllable, true), syllable.tone))
|
|
25
22
|
.join(system.separator);
|
|
26
23
|
}
|
|
27
24
|
//# sourceMappingURL=systems.js.map
|
package/dist/cli/systems.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systems.js","sourceRoot":"","sources":["../../src/cli/systems.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"systems.js","sourceRoot":"","sources":["../../src/cli/systems.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,UAAU,EACV,IAAI,GACL,MAAM,6BAA6B,CAAC;AAGrC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAmC,qBAAqB,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,IAAqC;IAErC,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,SAA8B,EAC9B,MAA2B,EAC3B,KAAc;IAEd,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;SACrE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type EdgeRule } from "./rules.js";
|
|
2
|
+
/**
|
|
3
|
+
* 过 read toneless where it marks experiential aspect.
|
|
4
|
+
*
|
|
5
|
+
* 他去过法国 came out `qùguò`, and 我吃过饭了, 你去过京都吗 and every 见过,
|
|
6
|
+
* 听说过 and 工作过 with them. The dictionary already holds the toneless
|
|
7
|
+
* reading as an alternate of `guò` and the lattice already offers the edge, and
|
|
8
|
+
* nothing new is asserted here. What was missing is a preference, since the
|
|
9
|
+
* cost model has no way to reach one alternate of a character over another at
|
|
10
|
+
* a position no word covers. {@link MODAL_DE} was written for the same
|
|
11
|
+
* position.
|
|
12
|
+
*
|
|
13
|
+
* The word in front decides it. Aspect attaches to a verb and to nothing else.
|
|
14
|
+
* A 过 with a verbal word ending immediately before it is the marker (去过,
|
|
15
|
+
* 吃过, 听说过, 告诉过, 工作过). The far side is silent, because an object, a
|
|
16
|
+
* 了, a 吗 and the end of the sentence all follow the marker as readily as they
|
|
17
|
+
* follow the verb 过. See {@link carriesGuo} for the pairs that carry a `guò`
|
|
18
|
+
* past a forced edge.
|
|
19
|
+
*
|
|
20
|
+
* Over 88,866 lines of Tatoeba and zh.wikipedia, 1,437 过 and 過 decode as a
|
|
21
|
+
* word of their own and every one of them reads `guò`. This moves 1,002 of
|
|
22
|
+
* them, and 29 more that no boundary had split out. Sized before it was
|
|
23
|
+
* written, the condition holds for 998 of the 1,437 and is right on 939. The
|
|
24
|
+
* 59 misses fall into five groups. 38 hand the 过 to a directional or
|
|
25
|
+
* resultative complement (他游过了河, 一隻老鼠跑過房間, 他们转过身, 我坐过站了,
|
|
26
|
+
* 回過神來). 14 are 过 as a verb behind a modal or an adverb (我們才能過比較好
|
|
27
|
+
* 的日子, 你要過聖誕節了嗎, 也许他不回去过春节). 4 are 过 meaning to exceed
|
|
28
|
+
* (期望过高 twice, 分享过多私人信息, 大象能活过一百岁). 2 belong to the word
|
|
29
|
+
* after (设置过马路警察, 提供过海巴士服务). One is the noun (忘功不忘過).
|
|
30
|
+
*
|
|
31
|
+
* 26 of the 998 keep their `guò` anyway, held by a word jieba counted and
|
|
32
|
+
* tagged. {@link TEACHING_JIAO} draws the same line. 打过 accounts for 12 of
|
|
33
|
+
* them, 过话 for 9 and 考过 for 2. All but 我坐过站了 were right already.
|
|
34
|
+
*
|
|
35
|
+
* The condition is deliberately no narrower, and four ways of tightening it
|
|
36
|
+
* were measured over the same lines. Excluding a modal in front gives up 32
|
|
37
|
+
* firings to catch 10 misses, 想过 being the marker in all 22 of its own.
|
|
38
|
+
* Excluding a single-character adjective after gives up 4 to catch 2, the
|
|
39
|
+
* others being 见过胖的纯素食者 and 见过新来的那货. Excluding a 了 after gives
|
|
40
|
+
* up 45 to catch 11, most of the 45 being 我吃过了 and 我说过了. The fourth
|
|
41
|
+
* pays and is rejected all the same. A written-out set of the verbs that take
|
|
42
|
+
* a crossing 过 (游, 跑, 跃, 转, 吹, 滑, 跳, 擦, 逃, 拉, 扔, 躲) gives up 28
|
|
43
|
+
* firings to catch 26, which would take the rule from 94% right to 96%. Those
|
|
44
|
+
* verbs take the marker too, and the corpus is thin on the sentences where they
|
|
45
|
+
* do. 我在这个泳池里游过泳 and 但我從没游過泳 are the whole of the measured
|
|
46
|
+
* cost, while 跑过马拉松 and 跳过舞 are absent from it and would break. The
|
|
47
|
+
* crossings the set catches are a gap in the dictionary rather than a fact
|
|
48
|
+
* about the grammar, since 走过, 穿过, 越过 and 度过 are keys tagged `v` and no
|
|
49
|
+
* bare 过 ever stands where they do.
|
|
50
|
+
*
|
|
51
|
+
* Taking a pair off the lattice moves a boundary as well as a reading, and it
|
|
52
|
+
* does so in 48 runs. 30 of those are corrections to both (你洗過車子了嗎 was
|
|
53
|
+
* `xǐ guòchē zǐ`, 我曾經想過當個護士嗎 was `xiǎng guòdàng`, 只是校服过时了 was
|
|
54
|
+
* `guò shí`). 4 are the cost. 懷有過高的期望 loses its 过高, and 有过来往,
|
|
55
|
+
* 沒再見過她 and 只見過他一次 keep their syllables and lose a word boundary to
|
|
56
|
+
* 过来, 再见 and 只见.
|
|
57
|
+
*
|
|
58
|
+
* The 439 bare 过 the condition declines hold a good deal of the marker, and
|
|
59
|
+
* one cause accounts for most of them. jieba's tags are keyed on 简体, so 聽
|
|
60
|
+
* and 讀 carry no tag at all and 說, 來, 問 and 學 come back `zg`. That gap is
|
|
61
|
+
* not this rule's to close.
|
|
62
|
+
*/
|
|
63
|
+
export declare const EXPERIENTIAL_GUO: EdgeRule;
|
|
64
|
+
//# sourceMappingURL=guo-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guo-rule.d.ts","sourceRoot":"","sources":["../../src/decode/guo-rule.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AAoEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAa9B,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a 过 is the experiential aspect marker or a verb of its own.
|
|
3
|
+
*
|
|
4
|
+
* The marker is toneless and the verb is `guò`, and the word in front is the
|
|
5
|
+
* evidence, since only a verb takes aspect.
|
|
6
|
+
*/
|
|
7
|
+
import { toCharacters } from "../script/characters.js";
|
|
8
|
+
import { tagOf, wordsEndingAt, } from "./rules.js";
|
|
9
|
+
/**
|
|
10
|
+
* The two characters the experiential marker is written with.
|
|
11
|
+
*
|
|
12
|
+
* 過 is the 繁體 form and carries the same three readings, so both have to be
|
|
13
|
+
* named. The 长 rule gives the reason at length.
|
|
14
|
+
*/
|
|
15
|
+
const MARKER = new Set(["过", "過"]);
|
|
16
|
+
/**
|
|
17
|
+
* The tag prefix jieba gives a verb. Only a verb takes aspect.
|
|
18
|
+
*
|
|
19
|
+
* A prefix, so that `vn`, `vd` and `vi` are in. 检查过了 and 工作过 are the
|
|
20
|
+
* shape, and jieba tags 检查 `vn`.
|
|
21
|
+
*/
|
|
22
|
+
const VERB_TAG = "v";
|
|
23
|
+
/**
|
|
24
|
+
* Whether a syllable is toneless `guo`, the reading the marker takes.
|
|
25
|
+
*/
|
|
26
|
+
function isGuo(syllable) {
|
|
27
|
+
return (syllable?.initial === "g" && syllable.final === "uo" && syllable.tone === 5);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether a verb ends at a position.
|
|
31
|
+
*
|
|
32
|
+
* Every word ending there is asked, and not only the longest, for the reason
|
|
33
|
+
* {@link wordsEndingAt} gives. 前去 is a time word and hides the 去 inside it,
|
|
34
|
+
* so 我以前去过这家店 saw a `t` where the verb was, and 我去 is a pair the
|
|
35
|
+
* dictionary holds with no part of speech at all and hid the same 去 in 我去過
|
|
36
|
+
* 巴黎.
|
|
37
|
+
*/
|
|
38
|
+
function isVerbEndingAt(context, at) {
|
|
39
|
+
return wordsEndingAt(context, at).some((word) => tagOf(context, word).startsWith(VERB_TAG));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether a pair the dictionary holds carries a fourth-tone 过 into a marker's
|
|
43
|
+
* position.
|
|
44
|
+
*
|
|
45
|
+
* Forcing the single-character edge settles nothing on its own, since a reading
|
|
46
|
+
* spanning two characters brings its own 过 with it. 我从没见过风车 read `guò`
|
|
47
|
+
* off 见过 and 你已經吃過飯了 off 吃過飯, and 期望过高, 说过话 and 洗过车 each
|
|
48
|
+
* reached the same reading from one side or the other.
|
|
49
|
+
*
|
|
50
|
+
* Only a pair is asked, and only one holding a syllable for each of its
|
|
51
|
+
* characters. A three-character key is a word in its own right and keeps its
|
|
52
|
+
* 过 (睡过头, 过马路, 反应过度), where a pair spanning the marker and its
|
|
53
|
+
* neighbour is a reading somebody recorded rather than a word anybody counted.
|
|
54
|
+
*/
|
|
55
|
+
function carriesGuo(context, edge) {
|
|
56
|
+
if (edge.to - edge.from !== 2 || edge.reading.length !== 2) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return toCharacters(edge.text).some((character, offset) => MARKER.has(character) &&
|
|
60
|
+
!isGuo(edge.reading[offset]) &&
|
|
61
|
+
isVerbEndingAt(context, edge.from + offset));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 过 read toneless where it marks experiential aspect.
|
|
65
|
+
*
|
|
66
|
+
* 他去过法国 came out `qùguò`, and 我吃过饭了, 你去过京都吗 and every 见过,
|
|
67
|
+
* 听说过 and 工作过 with them. The dictionary already holds the toneless
|
|
68
|
+
* reading as an alternate of `guò` and the lattice already offers the edge, and
|
|
69
|
+
* nothing new is asserted here. What was missing is a preference, since the
|
|
70
|
+
* cost model has no way to reach one alternate of a character over another at
|
|
71
|
+
* a position no word covers. {@link MODAL_DE} was written for the same
|
|
72
|
+
* position.
|
|
73
|
+
*
|
|
74
|
+
* The word in front decides it. Aspect attaches to a verb and to nothing else.
|
|
75
|
+
* A 过 with a verbal word ending immediately before it is the marker (去过,
|
|
76
|
+
* 吃过, 听说过, 告诉过, 工作过). The far side is silent, because an object, a
|
|
77
|
+
* 了, a 吗 and the end of the sentence all follow the marker as readily as they
|
|
78
|
+
* follow the verb 过. See {@link carriesGuo} for the pairs that carry a `guò`
|
|
79
|
+
* past a forced edge.
|
|
80
|
+
*
|
|
81
|
+
* Over 88,866 lines of Tatoeba and zh.wikipedia, 1,437 过 and 過 decode as a
|
|
82
|
+
* word of their own and every one of them reads `guò`. This moves 1,002 of
|
|
83
|
+
* them, and 29 more that no boundary had split out. Sized before it was
|
|
84
|
+
* written, the condition holds for 998 of the 1,437 and is right on 939. The
|
|
85
|
+
* 59 misses fall into five groups. 38 hand the 过 to a directional or
|
|
86
|
+
* resultative complement (他游过了河, 一隻老鼠跑過房間, 他们转过身, 我坐过站了,
|
|
87
|
+
* 回過神來). 14 are 过 as a verb behind a modal or an adverb (我們才能過比較好
|
|
88
|
+
* 的日子, 你要過聖誕節了嗎, 也许他不回去过春节). 4 are 过 meaning to exceed
|
|
89
|
+
* (期望过高 twice, 分享过多私人信息, 大象能活过一百岁). 2 belong to the word
|
|
90
|
+
* after (设置过马路警察, 提供过海巴士服务). One is the noun (忘功不忘過).
|
|
91
|
+
*
|
|
92
|
+
* 26 of the 998 keep their `guò` anyway, held by a word jieba counted and
|
|
93
|
+
* tagged. {@link TEACHING_JIAO} draws the same line. 打过 accounts for 12 of
|
|
94
|
+
* them, 过话 for 9 and 考过 for 2. All but 我坐过站了 were right already.
|
|
95
|
+
*
|
|
96
|
+
* The condition is deliberately no narrower, and four ways of tightening it
|
|
97
|
+
* were measured over the same lines. Excluding a modal in front gives up 32
|
|
98
|
+
* firings to catch 10 misses, 想过 being the marker in all 22 of its own.
|
|
99
|
+
* Excluding a single-character adjective after gives up 4 to catch 2, the
|
|
100
|
+
* others being 见过胖的纯素食者 and 见过新来的那货. Excluding a 了 after gives
|
|
101
|
+
* up 45 to catch 11, most of the 45 being 我吃过了 and 我说过了. The fourth
|
|
102
|
+
* pays and is rejected all the same. A written-out set of the verbs that take
|
|
103
|
+
* a crossing 过 (游, 跑, 跃, 转, 吹, 滑, 跳, 擦, 逃, 拉, 扔, 躲) gives up 28
|
|
104
|
+
* firings to catch 26, which would take the rule from 94% right to 96%. Those
|
|
105
|
+
* verbs take the marker too, and the corpus is thin on the sentences where they
|
|
106
|
+
* do. 我在这个泳池里游过泳 and 但我從没游過泳 are the whole of the measured
|
|
107
|
+
* cost, while 跑过马拉松 and 跳过舞 are absent from it and would break. The
|
|
108
|
+
* crossings the set catches are a gap in the dictionary rather than a fact
|
|
109
|
+
* about the grammar, since 走过, 穿过, 越过 and 度过 are keys tagged `v` and no
|
|
110
|
+
* bare 过 ever stands where they do.
|
|
111
|
+
*
|
|
112
|
+
* Taking a pair off the lattice moves a boundary as well as a reading, and it
|
|
113
|
+
* does so in 48 runs. 30 of those are corrections to both (你洗過車子了嗎 was
|
|
114
|
+
* `xǐ guòchē zǐ`, 我曾經想過當個護士嗎 was `xiǎng guòdàng`, 只是校服过时了 was
|
|
115
|
+
* `guò shí`). 4 are the cost. 懷有過高的期望 loses its 过高, and 有过来往,
|
|
116
|
+
* 沒再見過她 and 只見過他一次 keep their syllables and lose a word boundary to
|
|
117
|
+
* 过来, 再见 and 只见.
|
|
118
|
+
*
|
|
119
|
+
* The 439 bare 过 the condition declines hold a good deal of the marker, and
|
|
120
|
+
* one cause accounts for most of them. jieba's tags are keyed on 简体, so 聽
|
|
121
|
+
* and 讀 carry no tag at all and 說, 來, 問 and 學 come back `zg`. That gap is
|
|
122
|
+
* not this rule's to close.
|
|
123
|
+
*/
|
|
124
|
+
export const EXPERIENTIAL_GUO = {
|
|
125
|
+
name: "experiential-guo",
|
|
126
|
+
verdictFor: (context) => {
|
|
127
|
+
const { edge } = context;
|
|
128
|
+
if (MARKER.has(edge.text)) {
|
|
129
|
+
return isGuo(edge.reading[0]) && isVerbEndingAt(context, edge.from)
|
|
130
|
+
? "force"
|
|
131
|
+
: "keep";
|
|
132
|
+
}
|
|
133
|
+
return edge.partOfSpeech === "" && carriesGuo(context, edge)
|
|
134
|
+
? "forbid"
|
|
135
|
+
: "keep";
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=guo-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guo-rule.js","sourceRoot":"","sources":["../../src/decode/guo-rule.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAGL,KAAK,EACL,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB;;GAEG;AACH,SAAS,KAAK,CAAC,QAA8B;IAC3C,OAAO,CACL,QAAQ,EAAE,OAAO,KAAK,GAAG,IAAI,QAAQ,CAAC,KAAK,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED;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AAO;gBACT,CAAC,CAAC,MAAM,CAAC;QACb,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,KAAK,EAAE,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC;YAC1D,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reading-rules.d.ts","sourceRoot":"","sources":["../../src/decode/reading-rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reading-rules.d.ts","sourceRoot":"","sources":["../../src/decode/reading-rules.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAEL,KAAK,QAAQ,EAGd,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,EAAE,QAY5B,CAAC;AAsCF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,eAAe,EAAE,QAuB7B,CAAC;AAIF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,QAAQ,EAU5C,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { QUANTITY_CHARACTERS } from "../numerals/characters.js";
|
|
2
2
|
import { MODAL_DE, PARTICLE_DE, POTENTIAL_DE } from "./de-rule.js";
|
|
3
|
+
import { EXPERIENTIAL_GUO } from "./guo-rule.js";
|
|
3
4
|
import { TEACHING_JIAO } from "./jiao-rule.js";
|
|
4
5
|
export { MODAL_DE, PARTICLE_DE, POTENTIAL_DE } from "./de-rule.js";
|
|
6
|
+
export { EXPERIENTIAL_GUO } from "./guo-rule.js";
|
|
5
7
|
export { TEACHING_JIAO } from "./jiao-rule.js";
|
|
6
8
|
import { toCharacters } from "../script/characters.js";
|
|
7
9
|
import { tagOf, wordEndingAt, } from "./rules.js";
|
|
@@ -135,5 +137,6 @@ export const READING_RULES = [
|
|
|
135
137
|
COUNTED_MEASURE,
|
|
136
138
|
ADJECTIVAL_CHANG,
|
|
137
139
|
PLAYING_TAN,
|
|
140
|
+
EXPERIENTIAL_GUO,
|
|
138
141
|
];
|
|
139
142
|
//# sourceMappingURL=reading-rules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reading-rules.js","sourceRoot":"","sources":["../../src/decode/reading-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAGL,KAAK,EACL,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAa;IACtC,IAAI,EAAE,gBAAgB;IACtB,UAAU,EAAE,CAAC,OAAoB,EAAE,EAAE;QACnC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACrC,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACzC,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,wEAAwE;QACxE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AAW,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,OAAO;YACtD,IAAI,CAAC,YAAY,KAAK,OAAO;YAC7B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;CACF,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwB;IAChD,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,aAAa;IACb,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,gBAAgB;CACjB,CAAC"}
|
|
@@ -8,6 +8,52 @@
|
|
|
8
8
|
* against another.
|
|
9
9
|
*/
|
|
10
10
|
export declare const FREQUENCY_BUCKETS = 16;
|
|
11
|
+
/**
|
|
12
|
+
* What every word in a decoded path costs before its frequency is counted.
|
|
13
|
+
*
|
|
14
|
+
* A bucket is `log f` on a scale where the most frequent word in the corpus
|
|
15
|
+
* reaches {@link MAX_BUCKET}, so bucket *b* stands for `log f = b · L / 15`
|
|
16
|
+
* where `L = log(1 + f_max)`. The decoder wants `−log P = log N − log f`, which
|
|
17
|
+
* on that same scale is `15 · log N / L − b`, so the constant term is
|
|
18
|
+
* `15 · (log N / L − 1)` rather than the 1 that was here before. That
|
|
19
|
+
* arithmetic is {@link derivedWordCharge}, and the build holds this constant to
|
|
20
|
+
* it, since a constant in `src/` is the one thing a corpus refresh cannot
|
|
21
|
+
* bring with it.
|
|
22
|
+
*
|
|
23
|
+
* **`N` is jieba's corpus**, which is where every count in the dictionary comes
|
|
24
|
+
* from. As the build parses it, 60,101,964 occurrences over 349,045 words with
|
|
25
|
+
* 了 the busiest at 883,634, giving `log N = 17.91`, `L = 13.69` and a charge
|
|
26
|
+
* of 4.62. Only the *ratio* of the two logarithms matters, and it moves slowly.
|
|
27
|
+
* Doubling every count in the corpus shifts it by 0.05.
|
|
28
|
+
*
|
|
29
|
+
* **Summing `full.counts` gives 82,372,768, and that is not `N`.** The artifact
|
|
30
|
+
* attributes one corpus to more keys than jieba has words. A 繁體 spelling
|
|
31
|
+
* claims its 简体 entry's count, and `traditional-carry.ts` lends a count to a
|
|
32
|
+
* 繁體 character holding an entry of its own. 银行 and 銀行 are one word met
|
|
33
|
+
* once and two keys counted twice, and 20,447,271 of that total sits on keys
|
|
34
|
+
* jieba does not list at all.
|
|
35
|
+
*
|
|
36
|
+
* The value is load-bearing. At the old charge of 1 the lattice decoder read
|
|
37
|
+
* 还给 as 还 + 给 and 还是 as 还 + 是, because two common characters summed to
|
|
38
|
+
* less than one uncommon word. At the derived charge both stay whole.
|
|
39
|
+
*
|
|
40
|
+
* **Its exact value inside a unit is not.** Buckets are integers, so a path
|
|
41
|
+
* carrying *k* words more than its rival turns on where `k · charge` falls
|
|
42
|
+
* between two of them. 4.62 and 4.97 agree at `k` of 1 and 2 and first differ
|
|
43
|
+
* at 3. Converted at 4.97, 63 of the 139,682 Han runs in 88,866 lines of
|
|
44
|
+
* Tatoeba and zh.wikipedia come out differently, and every one of the 63
|
|
45
|
+
* decodes into as many words as it did before. They are exact ties in the
|
|
46
|
+
* bucket sum, re-broken by the order the floats happened to be added in.
|
|
47
|
+
*/
|
|
48
|
+
export declare const WORD_CHARGE = 4.62;
|
|
49
|
+
/**
|
|
50
|
+
* The charge a corpus derives, for the build to hold {@link WORD_CHARGE} to.
|
|
51
|
+
*
|
|
52
|
+
* `total` is the corpus, counted once. `highest` is the largest count in it,
|
|
53
|
+
* which is what {@link FrequencyTable.build} scales the buckets by, so the two
|
|
54
|
+
* have to be read off the same corpus for the result to mean anything.
|
|
55
|
+
*/
|
|
56
|
+
export declare function derivedWordCharge(total: number, highest: number): number;
|
|
11
57
|
/**
|
|
12
58
|
* Quantised word frequencies, packed two to a byte.
|
|
13
59
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frequency-table.d.ts","sourceRoot":"","sources":["../../src/dictionary/frequency-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"frequency-table.d.ts","sourceRoot":"","sources":["../../src/dictionary/frequency-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;GAMG;AACH,qBAAa,cAAc;;IACzB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CA4B3D;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAE5D;IAKD;;;OAGG;IACH,OAAO,eAGN;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM9B;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5B;IAED;;OAEG;IACH,SAAS,IAAI,UAAU,CAEtB;CACF"}
|