@kensio/pinyinjs 1.9.0 → 1.9.1
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/dist/decode/chang-context.d.ts +4 -0
- package/dist/decode/chang-context.d.ts.map +1 -1
- package/dist/decode/chang-context.js +16 -2
- package/dist/decode/chang-context.js.map +1 -1
- package/dist/decode/chang-rule.d.ts.map +1 -1
- package/dist/decode/chang-rule.js +6 -0
- package/dist/decode/chang-rule.js.map +1 -1
- package/dist/decode/chang-span.d.ts +37 -0
- package/dist/decode/chang-span.d.ts.map +1 -0
- package/dist/decode/chang-span.js +100 -0
- package/dist/decode/chang-span.js.map +1 -0
- package/dist/decode/chong-frames.d.ts +9 -0
- package/dist/decode/chong-frames.d.ts.map +1 -0
- package/dist/decode/chong-frames.js +58 -0
- package/dist/decode/chong-frames.js.map +1 -0
- package/dist/decode/ding-frames.d.ts +8 -0
- package/dist/decode/ding-frames.d.ts.map +1 -0
- package/dist/decode/ding-frames.js +54 -0
- package/dist/decode/ding-frames.js.map +1 -0
- package/dist/decode/dominant-readings.d.ts +55 -0
- package/dist/decode/dominant-readings.d.ts.map +1 -0
- package/dist/decode/dominant-readings.js +67 -0
- package/dist/decode/dominant-readings.js.map +1 -0
- package/dist/decode/dominant-rule.d.ts +24 -0
- package/dist/decode/dominant-rule.d.ts.map +1 -0
- package/dist/decode/dominant-rule.js +122 -0
- package/dist/decode/dominant-rule.js.map +1 -0
- package/dist/decode/guo-rule.d.ts.map +1 -1
- package/dist/decode/guo-rule.js +12 -0
- package/dist/decode/guo-rule.js.map +1 -1
- package/dist/decode/hao-rule.d.ts +16 -0
- package/dist/decode/hao-rule.d.ts.map +1 -0
- package/dist/decode/hao-rule.js +61 -0
- package/dist/decode/hao-rule.js.map +1 -0
- package/dist/decode/ji-frames.d.ts +9 -0
- package/dist/decode/ji-frames.d.ts.map +1 -0
- package/dist/decode/ji-frames.js +71 -0
- package/dist/decode/ji-frames.js.map +1 -0
- package/dist/decode/jiao-rule.d.ts +5 -6
- package/dist/decode/jiao-rule.d.ts.map +1 -1
- package/dist/decode/jiao-rule.js +39 -3
- package/dist/decode/jiao-rule.js.map +1 -1
- package/dist/decode/jie-frames.d.ts +6 -0
- package/dist/decode/jie-frames.d.ts.map +1 -0
- package/dist/decode/jie-frames.js +94 -0
- package/dist/decode/jie-frames.js.map +1 -0
- package/dist/decode/liang-frames.d.ts +6 -0
- package/dist/decode/liang-frames.d.ts.map +1 -0
- package/dist/decode/liang-frames.js +112 -0
- package/dist/decode/liang-frames.js.map +1 -0
- package/dist/decode/polyphone-rules.d.ts +2 -1
- package/dist/decode/polyphone-rules.d.ts.map +1 -1
- package/dist/decode/polyphone-rules.js +2 -1
- package/dist/decode/polyphone-rules.js.map +1 -1
- package/dist/decode/reading-rules.d.ts +3 -1
- package/dist/decode/reading-rules.d.ts.map +1 -1
- package/dist/decode/reading-rules.js +9 -2
- package/dist/decode/reading-rules.js.map +1 -1
- package/dist/decode/reduplication-readings.d.ts +26 -0
- package/dist/decode/reduplication-readings.d.ts.map +1 -0
- package/dist/decode/reduplication-readings.js +48 -0
- package/dist/decode/reduplication-readings.js.map +1 -0
- package/dist/decode/reduplication-rule.d.ts +1 -1
- package/dist/decode/reduplication-rule.d.ts.map +1 -1
- package/dist/decode/reduplication-rule.js +2 -41
- package/dist/decode/reduplication-rule.js.map +1 -1
- package/dist/decode/shu-frames.d.ts +6 -0
- package/dist/decode/shu-frames.d.ts.map +1 -0
- package/dist/decode/shu-frames.js +102 -0
- package/dist/decode/shu-frames.js.map +1 -0
- package/dist/decode/split-infix.d.ts +25 -0
- package/dist/decode/split-infix.d.ts.map +1 -0
- package/dist/decode/split-infix.js +134 -0
- package/dist/decode/split-infix.js.map +1 -0
- package/dist/decode/split-rule.d.ts +11 -0
- package/dist/decode/split-rule.d.ts.map +1 -1
- package/dist/decode/split-rule.js +17 -4
- package/dist/decode/split-rule.js.map +1 -1
- package/dist/decode/tiao-frames.d.ts +6 -0
- package/dist/decode/tiao-frames.d.ts.map +1 -0
- package/dist/decode/tiao-frames.js +60 -0
- package/dist/decode/tiao-frames.js.map +1 -0
- package/dist/decode/verbal-frame.d.ts +68 -0
- package/dist/decode/verbal-frame.d.ts.map +1 -0
- package/dist/decode/verbal-frame.js +76 -0
- package/dist/decode/verbal-frame.js.map +1 -0
- package/dist/decode/verbal-held.d.ts +12 -0
- package/dist/decode/verbal-held.d.ts.map +1 -0
- package/dist/decode/verbal-held.js +63 -0
- package/dist/decode/verbal-held.js.map +1 -0
- package/dist/decode/verbal-rule.d.ts +31 -0
- package/dist/decode/verbal-rule.d.ts.map +1 -0
- package/dist/decode/verbal-rule.js +100 -0
- package/dist/decode/verbal-rule.js.map +1 -0
- package/dist/decode/xiang-frames.d.ts +6 -0
- package/dist/decode/xiang-frames.d.ts.map +1 -0
- package/dist/decode/xiang-frames.js +65 -0
- package/dist/decode/xiang-frames.js.map +1 -0
- package/dist/decode/zhuan-frames.d.ts +6 -0
- package/dist/decode/zhuan-frames.d.ts.map +1 -0
- package/dist/decode/zhuan-frames.js +97 -0
- package/dist/decode/zhuan-frames.js.map +1 -0
- package/dist/dictionary/frequency-table.d.ts +8 -0
- package/dist/dictionary/frequency-table.d.ts.map +1 -1
- package/dist/dictionary/frequency-table.js +11 -1
- package/dist/dictionary/frequency-table.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,10 @@ import { type EdgeContext } from "./rules.js";
|
|
|
7
7
|
* as readily as it is 不长.
|
|
8
8
|
*/
|
|
9
9
|
export declare function isPredicated(context: EdgeContext): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a 长 ends its clause, with at most a closing particle after it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function closesClause(context: EdgeContext): boolean;
|
|
10
14
|
/**
|
|
11
15
|
* Whether a 长 is an adjective in front of the noun it modifies.
|
|
12
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chang-context.d.ts","sourceRoot":"","sources":["../../src/decode/chang-context.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,YAAY,CAAC;AAqBpB;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"chang-context.d.ts","sourceRoot":"","sources":["../../src/decode/chang-context.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,YAAY,CAAC;AAqBpB;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAM1D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAG1D;AA4CD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAY3D"}
|
|
@@ -36,7 +36,13 @@ export function isPredicated(context) {
|
|
|
36
36
|
if (!SCOPING.has(characters[edge.from - 1] ?? "")) {
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
return closesClause(context);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether a 长 ends its clause, with at most a closing particle after it.
|
|
43
|
+
*/
|
|
44
|
+
export function closesClause(context) {
|
|
45
|
+
const after = context.characters[context.edge.to];
|
|
40
46
|
return after === undefined || CLOSING.has(after);
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
@@ -47,6 +53,14 @@ const MEASURE = "q";
|
|
|
47
53
|
* The tag prefix a noun carries, which is what an attributive 长 modifies.
|
|
48
54
|
*/
|
|
49
55
|
const NOUN_TAG = "n";
|
|
56
|
+
/**
|
|
57
|
+
* The particle that hands a noun phrase its modifier.
|
|
58
|
+
*
|
|
59
|
+
* 宽松的长外套 and 你的长周末. A noun after a 的 and a 长 is what the 长
|
|
60
|
+
* describes, since a verb after a 的 would need a subject the 的 has already
|
|
61
|
+
* spent.
|
|
62
|
+
*/
|
|
63
|
+
const POSSESSIVE = "的";
|
|
50
64
|
/**
|
|
51
65
|
* The mark that makes the number after it a position rather than a count.
|
|
52
66
|
*/
|
|
@@ -94,6 +108,6 @@ export function isAttributive(context) {
|
|
|
94
108
|
if (isOrdinalPhrase(context, edge.from)) {
|
|
95
109
|
return false;
|
|
96
110
|
}
|
|
97
|
-
return wordsEndingAt(context, edge.from).some((word) => word === "有" || tagOf(context, word) === MEASURE);
|
|
111
|
+
return wordsEndingAt(context, edge.from).some((word) => word === "有" || word === POSSESSIVE || tagOf(context, word) === MEASURE);
|
|
98
112
|
}
|
|
99
113
|
//# sourceMappingURL=chang-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chang-context.js","sourceRoot":"","sources":["../../src/decode/chang-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAEL,KAAK,EACL,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB;;;;;;;;GAQG;AACH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAAoB;IAC/C,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACrC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAA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AO,CAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chang-rule.d.ts","sourceRoot":"","sources":["../../src/decode/chang-rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chang-rule.d.ts","sourceRoot":"","sources":["../../src/decode/chang-rule.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAoB,KAAK,QAAQ,EAAiB,MAAM,YAAY,CAAC;AA+H5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,gBAAgB,EAAE,QA8B9B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isCompared, isMeasured } from "./chang-complement.js";
|
|
2
2
|
import { isAttributive, isPredicated } from "./chang-context.js";
|
|
3
|
+
import { isBecome, isComparedWith, isCoordinated, isSpanAhead, isSpanMeasured, } from "./chang-span.js";
|
|
3
4
|
import { wordsEndingAt } from "./rules.js";
|
|
4
5
|
/**
|
|
5
6
|
* Whether a syllable is `cháng`, the stative reading of 长.
|
|
@@ -176,6 +177,11 @@ export const ADJECTIVAL_CHANG = {
|
|
|
176
177
|
}
|
|
177
178
|
if (isPredicated(context) ||
|
|
178
179
|
isAttributive(context) ||
|
|
180
|
+
isSpanAhead(context) ||
|
|
181
|
+
isCoordinated(context) ||
|
|
182
|
+
isBecome(context) ||
|
|
183
|
+
isSpanMeasured(context) ||
|
|
184
|
+
isComparedWith(context) ||
|
|
179
185
|
isCompared(context) ||
|
|
180
186
|
isMeasured(context)) {
|
|
181
187
|
return "force";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chang-rule.js","sourceRoot":"","sources":["../../src/decode/chang-rule.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjE,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AO,CAAC;QACjB,CAAC;QACD,OAAO,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACvE,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type EdgeContext } from "./rules.js";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a 长 stands in front of a span of time: 长时间, 长周末.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isSpanAhead(context: EdgeContext): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a 长 is the first of two qualities a 又…又 joins.
|
|
8
|
+
*
|
|
9
|
+
* 又长又冷 and 又长又直. `chang-context.ts` reads the second of the pair,
|
|
10
|
+
* 又瘦又长, as a predicate closing its clause. The first has a 又 on each side,
|
|
11
|
+
* and only a quality goes between them.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isCoordinated(context: EdgeContext): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a 长 is what something became: 白天日益变长, 影子变长了.
|
|
16
|
+
*
|
|
17
|
+
* The clause has to end after it, since 变长出 would be a verb after all.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isBecome(context: EdgeContext): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether a 长 says how long a span is: 时间长了, 工作时间长.
|
|
22
|
+
*
|
|
23
|
+
* The span is the word in front and the clause ends after the 长. 头发长了 is
|
|
24
|
+
* the same shape with a thing that grows, and a span cannot.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isSpanMeasured(context: EdgeContext): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a 长 closes a comparison: 时间比我想的长, 其刀刃比大刀长.
|
|
29
|
+
*
|
|
30
|
+
* A 比 standing as a word of its own earlier in the run sets up the
|
|
31
|
+
* comparison, and the 长 at the end of the clause is what is compared. A 比
|
|
32
|
+
* opening a longer word is something else (比作, 比较), and a 的 after the 长
|
|
33
|
+
* makes it a modifier inside the clause, as in 比作一棵…生长的大树. 比他长得高
|
|
34
|
+
* compares how tall, and its 得 keeps it out of the rule before this is asked.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isComparedWith(context: EdgeContext): boolean;
|
|
37
|
+
//# sourceMappingURL=chang-span.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chang-span.d.ts","sourceRoot":"","sources":["../../src/decode/chang-span.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,WAAW,EAKjB,MAAM,YAAY,CAAC;AAWpB;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAIzD;AAOD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAG3D;AAOD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAMtD;AAeD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAM5D;AAYD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAQ5D"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 长 contexts that name a span of time or a change in length.
|
|
3
|
+
*
|
|
4
|
+
* Each settles a 长 that `chang-context.ts` and `chang-complement.ts` leave to
|
|
5
|
+
* the character's default, `zhǎng`. In each, a word stands beside the 长 that
|
|
6
|
+
* only ever stands beside a length.
|
|
7
|
+
*
|
|
8
|
+
* Over 88,866 lines of Tatoeba and zh.wikipedia they change 9 readings in the
|
|
9
|
+
* full tier, 10 in the standard tier and 18 in the core tier. All are
|
|
10
|
+
* corrections except 菲利普的长子 in the core tier, which holds no word 长子.
|
|
11
|
+
* CPP's labelled accuracy holds at 91.86%.
|
|
12
|
+
*/
|
|
13
|
+
import { closesClause } from "./chang-context.js";
|
|
14
|
+
import { startsLongerWord, tagOf, wordsEndingAt, wordsStartingAt, } from "./rules.js";
|
|
15
|
+
/**
|
|
16
|
+
* Spans a 长 in front of can only be measuring.
|
|
17
|
+
*
|
|
18
|
+
* 长时间 is jieba's word with no reading in either source, so the lattice
|
|
19
|
+
* reaches it as 长 and 时间. Growing takes a thing that grows, and none of
|
|
20
|
+
* these do.
|
|
21
|
+
*/
|
|
22
|
+
const SPANS = new Set(["时间", "時間", "时期", "時期", "周末", "週末", "假期"]);
|
|
23
|
+
/**
|
|
24
|
+
* Whether a 长 stands in front of a span of time: 长时间, 长周末.
|
|
25
|
+
*/
|
|
26
|
+
export function isSpanAhead(context) {
|
|
27
|
+
return wordsStartingAt(context, context.edge.to).some((word) => SPANS.has(word));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The correlative that coordinates two qualities.
|
|
31
|
+
*/
|
|
32
|
+
const BOTH = "又";
|
|
33
|
+
/**
|
|
34
|
+
* Whether a 长 is the first of two qualities a 又…又 joins.
|
|
35
|
+
*
|
|
36
|
+
* 又长又冷 and 又长又直. `chang-context.ts` reads the second of the pair,
|
|
37
|
+
* 又瘦又长, as a predicate closing its clause. The first has a 又 on each side,
|
|
38
|
+
* and only a quality goes between them.
|
|
39
|
+
*/
|
|
40
|
+
export function isCoordinated(context) {
|
|
41
|
+
const { characters, edge } = context;
|
|
42
|
+
return characters[edge.from - 1] === BOTH && characters[edge.to] === BOTH;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Verbs of becoming, which take a quality as their result.
|
|
46
|
+
*/
|
|
47
|
+
const BECOMING = new Set(["变", "變", "变得", "變得"]);
|
|
48
|
+
/**
|
|
49
|
+
* Whether a 长 is what something became: 白天日益变长, 影子变长了.
|
|
50
|
+
*
|
|
51
|
+
* The clause has to end after it, since 变长出 would be a verb after all.
|
|
52
|
+
*/
|
|
53
|
+
export function isBecome(context) {
|
|
54
|
+
return (wordsEndingAt(context, context.edge.from).some((word) => BECOMING.has(word)) && closesClause(context));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The tag jieba gives a time word.
|
|
58
|
+
*/
|
|
59
|
+
const TIME_TAG = "t";
|
|
60
|
+
/**
|
|
61
|
+
* Subjects that are spans themselves, which a 长 after can only measure.
|
|
62
|
+
*
|
|
63
|
+
* jieba tags 冬天 and 白天 `t`, and 时间 and 日子 `n`, so the time words are
|
|
64
|
+
* taken by their tag and the rest named here.
|
|
65
|
+
*/
|
|
66
|
+
const SPAN_SUBJECTS = new Set(["时间", "時間", "日子", "距离", "距離", "路程"]);
|
|
67
|
+
/**
|
|
68
|
+
* Whether a 长 says how long a span is: 时间长了, 工作时间长.
|
|
69
|
+
*
|
|
70
|
+
* The span is the word in front and the clause ends after the 长. 头发长了 is
|
|
71
|
+
* the same shape with a thing that grows, and a span cannot.
|
|
72
|
+
*/
|
|
73
|
+
export function isSpanMeasured(context) {
|
|
74
|
+
return (wordsEndingAt(context, context.edge.from).some((word) => SPAN_SUBJECTS.has(word) || tagOf(context, word) === TIME_TAG) && closesClause(context));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The comparative marker, in both scripts.
|
|
78
|
+
*/
|
|
79
|
+
const THAN = "比";
|
|
80
|
+
/**
|
|
81
|
+
* The particle that makes what is before it a modifier.
|
|
82
|
+
*/
|
|
83
|
+
const MODIFYING = "的";
|
|
84
|
+
/**
|
|
85
|
+
* Whether a 长 closes a comparison: 时间比我想的长, 其刀刃比大刀长.
|
|
86
|
+
*
|
|
87
|
+
* A 比 standing as a word of its own earlier in the run sets up the
|
|
88
|
+
* comparison, and the 长 at the end of the clause is what is compared. A 比
|
|
89
|
+
* opening a longer word is something else (比作, 比较), and a 的 after the 长
|
|
90
|
+
* makes it a modifier inside the clause, as in 比作一棵…生长的大树. 比他长得高
|
|
91
|
+
* compares how tall, and its 得 keeps it out of the rule before this is asked.
|
|
92
|
+
*/
|
|
93
|
+
export function isComparedWith(context) {
|
|
94
|
+
const { characters, edge } = context;
|
|
95
|
+
const compares = characters
|
|
96
|
+
.slice(0, edge.from)
|
|
97
|
+
.some((character, at) => character === THAN && !startsLongerWord(context, at));
|
|
98
|
+
return compares && characters[edge.to] !== MODIFYING && closesClause(context);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=chang-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chang-span.js","sourceRoot":"","sources":["../../src/decode/chang-span.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAEL,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAoB;IAC9C,OAAO,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAC7D,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAChB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAAoB;IAChD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACrC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;A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I,CAAC;SACnB,IAAI,CACH,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAC,CACxE,CAAC;IACJ,OAAO,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,SAAS,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VerbalFrame } from "./verbal-frame.js";
|
|
2
|
+
/**
|
|
3
|
+
* 冲 read `chòng` where it is strong.
|
|
4
|
+
*
|
|
5
|
+
* 繁體 writes it 衝, which Unihan reads both ways too. 沖 rinses and is
|
|
6
|
+
* `chōng` alone.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CHONG_FRAME: VerbalFrame;
|
|
9
|
+
//# sourceMappingURL=chong-frames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chong-frames.d.ts","sourceRoot":"","sources":["../../src/decode/chong-frames.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AA0C3B;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,WAMzB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a 冲 is strong or is rushing.
|
|
3
|
+
*
|
|
4
|
+
* `chōng` rushes, rinses and charges, and is nearly every 冲 standing on its
|
|
5
|
+
* own. `chòng` is strong, of a smell or a manner (味道很冲, 他说话太冲), and
|
|
6
|
+
* stands where an adjective would, after a degree adverb.
|
|
7
|
+
*/
|
|
8
|
+
import { wordEndingAt } from "./rules.js";
|
|
9
|
+
import { isBareAt, isRunEnd, syllableOf, } from "./verbal-frame.js";
|
|
10
|
+
/**
|
|
11
|
+
* The degree adverbs an adjective follows.
|
|
12
|
+
*/
|
|
13
|
+
const DEGREE = new Set([
|
|
14
|
+
"很",
|
|
15
|
+
"太",
|
|
16
|
+
"真",
|
|
17
|
+
"挺",
|
|
18
|
+
"好",
|
|
19
|
+
"特别",
|
|
20
|
+
"非常",
|
|
21
|
+
"有点",
|
|
22
|
+
"有点儿",
|
|
23
|
+
"那么",
|
|
24
|
+
"这么",
|
|
25
|
+
"十分",
|
|
26
|
+
"比较",
|
|
27
|
+
"更",
|
|
28
|
+
"最",
|
|
29
|
+
]);
|
|
30
|
+
/**
|
|
31
|
+
* What can close a clause after an adjective: aspect, 的 and the sentence
|
|
32
|
+
* particles.
|
|
33
|
+
*/
|
|
34
|
+
const CLOSING = new Set(["了", "的", "啊", "呀", "吧", "呢", "哦"]);
|
|
35
|
+
/**
|
|
36
|
+
* Whether the 冲 at a position is strong.
|
|
37
|
+
*
|
|
38
|
+
* Only where the clause ends with it. 很冲动 is a word, and 太冲进去 is no
|
|
39
|
+
* sentence anybody writes, but the guard costs nothing.
|
|
40
|
+
*/
|
|
41
|
+
function isStrongAt(context, at) {
|
|
42
|
+
return (DEGREE.has(wordEndingAt(context, at) ?? "") &&
|
|
43
|
+
(isRunEnd(context, at + 1) || isBareAt(context, at + 1, CLOSING)));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 冲 read `chòng` where it is strong.
|
|
47
|
+
*
|
|
48
|
+
* 繁體 writes it 衝, which Unihan reads both ways too. 沖 rinses and is
|
|
49
|
+
* `chōng` alone.
|
|
50
|
+
*/
|
|
51
|
+
export const CHONG_FRAME = {
|
|
52
|
+
characters: new Set(["冲", "衝"]),
|
|
53
|
+
reading: syllableOf("chòng"),
|
|
54
|
+
boundBefore: new Set(),
|
|
55
|
+
boundAfter: new Set(),
|
|
56
|
+
isVerbalAt: isStrongAt,
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=chong-frames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chong-frames.js","sourceRoot":"","sources":["../../src/decode/chong-frames.ts"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src/decode/ding-frames.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAwC3B;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WAMxB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a 钉 is nailing something or is a nail.
|
|
3
|
+
*
|
|
4
|
+
* The verb is `dìng` and the noun `dīng`. The noun stands on its own in 竹钉,
|
|
5
|
+
* 一根钉 and 钉痕. The verb drives something in and says where: 钉进地里,
|
|
6
|
+
* 钉在十字架上.
|
|
7
|
+
*/
|
|
8
|
+
import { wordEndingAt } from "./rules.js";
|
|
9
|
+
import { isBareAt, startsWithAny, syllableOf, } from "./verbal-frame.js";
|
|
10
|
+
/**
|
|
11
|
+
* What follows a 钉 that is nailing: where it goes, and aspect.
|
|
12
|
+
*/
|
|
13
|
+
const COMPLEMENT = new Set([
|
|
14
|
+
"在",
|
|
15
|
+
"进",
|
|
16
|
+
"入",
|
|
17
|
+
"上",
|
|
18
|
+
"住",
|
|
19
|
+
"牢",
|
|
20
|
+
"死",
|
|
21
|
+
"紧",
|
|
22
|
+
"着",
|
|
23
|
+
"了",
|
|
24
|
+
"到",
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* What is nailed, or nailed with: 钉十字架, 钉钉子.
|
|
28
|
+
*/
|
|
29
|
+
const NAILED = ["十字架", "钉子"];
|
|
30
|
+
/**
|
|
31
|
+
* The passive marker. Nothing but the verb follows it: 被钉十字架.
|
|
32
|
+
*/
|
|
33
|
+
const PASSIVE = "被";
|
|
34
|
+
/**
|
|
35
|
+
* Whether the 钉 at a position is nailing.
|
|
36
|
+
*/
|
|
37
|
+
function isNailingAt(context, at) {
|
|
38
|
+
return (isBareAt(context, at + 1, COMPLEMENT) ||
|
|
39
|
+
startsWithAny(context, at + 1, NAILED) ||
|
|
40
|
+
wordEndingAt(context, at) === PASSIVE);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 钉 read `dìng` where it is nailing.
|
|
44
|
+
*
|
|
45
|
+
* Unihan gives 釘 `dīng` alone, so only 钉 is here.
|
|
46
|
+
*/
|
|
47
|
+
export const DING_FRAME = {
|
|
48
|
+
characters: new Set(["钉"]),
|
|
49
|
+
reading: syllableOf("dìng"),
|
|
50
|
+
boundBefore: new Set(),
|
|
51
|
+
boundAfter: new Set(),
|
|
52
|
+
isVerbalAt: isNailingAt,
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=ding-frames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ding-frames.js","sourceRoot":"","sources":["../../src/decode/ding-frames.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAoB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EACL,QAAQ,EACR,aAAa,EACb,UAAU,GAEX,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAE7B;;GAEG;AACH,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB;;GAEG;AACH,SAAS,WAAW,CAAC,OAAoB,EAAE,EAAU;IACnD,OAAO,CACL,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,EAAE,UAAU,CAAC;QACrC,aAAa,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QACtC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,OAAO,CACtC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC;IAC3B,WAAW,EAAE,IAAI,GAAG,EAAE;IACtB,UAAU,EAAE,IAAI,GAAG,EAAE;IACrB,UAAU,EAAE,WAAW;CACxB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The function words a pair nobody counted may not read their rare way, and
|
|
3
|
+
* the side of the pair each has to stand on.
|
|
4
|
+
*
|
|
5
|
+
* Kept apart from the rule that reads it, as the 干 frames are.
|
|
6
|
+
*/
|
|
7
|
+
import { type Syllable } from "../syllable/syllable.js";
|
|
8
|
+
/**
|
|
9
|
+
* Which character of a pair a function word has to be for the rule to take the
|
|
10
|
+
* pair.
|
|
11
|
+
*
|
|
12
|
+
* The other side is where the compounds with a sense of their own sit. 都护,
|
|
13
|
+
* 都邑 and 间日 open with the rare reading, 停更, 俸给 and 淹没 close with it,
|
|
14
|
+
* and each was right. 的 and 着 have no such side: 破的 takes a 的 from the verb
|
|
15
|
+
* before it and 着笔 takes a 着 from the verb before it as well.
|
|
16
|
+
*/
|
|
17
|
+
export type Side = "first" | "second" | "either";
|
|
18
|
+
/**
|
|
19
|
+
* A function word's side of a pair, and the readings a pair nobody counted
|
|
20
|
+
* may not give it there.
|
|
21
|
+
*/
|
|
22
|
+
export interface RareReading {
|
|
23
|
+
readonly side: Side;
|
|
24
|
+
readonly readings: readonly Syllable[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The function words, and their rare readings.
|
|
28
|
+
*
|
|
29
|
+
* kHanyuPinlu counts each usual reading at thirty times the rare one or more,
|
|
30
|
+
* and a page of example sentences met each rare reading through a pair:
|
|
31
|
+
*
|
|
32
|
+
* | Character | Usual reading | Rare reading | Pair |
|
|
33
|
+
* | --------- | ------------- | ------------ | ---- |
|
|
34
|
+
* | 的 | de (75,596) | dì (157) | 破的 |
|
|
35
|
+
* | 着 | zhe (10,643) | zhuó (125) | 着笔 |
|
|
36
|
+
* | 给 | gěi (2,860) | jǐ (80) | 家给 |
|
|
37
|
+
* | 更 | gèng (1,405) | gēng (27) | 更香 |
|
|
38
|
+
* | 都 | dōu (5,680) | dū (93) | 上都 |
|
|
39
|
+
* | 没 | méi (5,589) | mò (44) | 没过 |
|
|
40
|
+
* | 间 | jiān (2,080) | jiàn (15) | 有间 |
|
|
41
|
+
* | 赚 | zhuàn (25) | zuàn (none) | 赚得 |
|
|
42
|
+
*
|
|
43
|
+
* 着 keeps `zháo`, which it takes one time in twenty and which 睡不着 needs.
|
|
44
|
+
* The same odds over every polyphone would take in 系 `jì` (724 to 15) and
|
|
45
|
+
* with it 系好安全带, so the list holds the characters a page showed going
|
|
46
|
+
* wrong.
|
|
47
|
+
*
|
|
48
|
+
* Both scripts, since a 繁體 pair is a key of its own.
|
|
49
|
+
*/
|
|
50
|
+
export declare const RARE_READINGS: ReadonlyMap<string, RareReading>;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the character at an index of a pair stands on a side.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isOnSide(side: Side, index: number): boolean;
|
|
55
|
+
//# sourceMappingURL=dominant-readings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dominant-readings.d.ts","sourceRoot":"","sources":["../../src/decode/dominant-readings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,CAAC;CACxC;AAcD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAqB1D,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The function words a pair nobody counted may not read their rare way, and
|
|
3
|
+
* the side of the pair each has to stand on.
|
|
4
|
+
*
|
|
5
|
+
* Kept apart from the rule that reads it, as the 干 frames are.
|
|
6
|
+
*/
|
|
7
|
+
import { readSyllable } from "../syllable/syllable.js";
|
|
8
|
+
/**
|
|
9
|
+
* Read one syllable of {@link RARE_READINGS}, throwing if it is malformed.
|
|
10
|
+
*/
|
|
11
|
+
function readingOf(text) {
|
|
12
|
+
const syllable = readSyllable(text);
|
|
13
|
+
/* c8 ignore next 3 -- the table is written below and parses */
|
|
14
|
+
if (syllable === undefined) {
|
|
15
|
+
throw new Error(`not a syllable: ${text}`);
|
|
16
|
+
}
|
|
17
|
+
return syllable;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The function words, and their rare readings.
|
|
21
|
+
*
|
|
22
|
+
* kHanyuPinlu counts each usual reading at thirty times the rare one or more,
|
|
23
|
+
* and a page of example sentences met each rare reading through a pair:
|
|
24
|
+
*
|
|
25
|
+
* | Character | Usual reading | Rare reading | Pair |
|
|
26
|
+
* | --------- | ------------- | ------------ | ---- |
|
|
27
|
+
* | 的 | de (75,596) | dì (157) | 破的 |
|
|
28
|
+
* | 着 | zhe (10,643) | zhuó (125) | 着笔 |
|
|
29
|
+
* | 给 | gěi (2,860) | jǐ (80) | 家给 |
|
|
30
|
+
* | 更 | gèng (1,405) | gēng (27) | 更香 |
|
|
31
|
+
* | 都 | dōu (5,680) | dū (93) | 上都 |
|
|
32
|
+
* | 没 | méi (5,589) | mò (44) | 没过 |
|
|
33
|
+
* | 间 | jiān (2,080) | jiàn (15) | 有间 |
|
|
34
|
+
* | 赚 | zhuàn (25) | zuàn (none) | 赚得 |
|
|
35
|
+
*
|
|
36
|
+
* 着 keeps `zháo`, which it takes one time in twenty and which 睡不着 needs.
|
|
37
|
+
* The same odds over every polyphone would take in 系 `jì` (724 to 15) and
|
|
38
|
+
* with it 系好安全带, so the list holds the characters a page showed going
|
|
39
|
+
* wrong.
|
|
40
|
+
*
|
|
41
|
+
* Both scripts, since a 繁體 pair is a key of its own.
|
|
42
|
+
*/
|
|
43
|
+
export const RARE_READINGS = new Map([
|
|
44
|
+
["的", "either", ["di4", "di2"]],
|
|
45
|
+
["着", "either", ["zhuo2", "zhao1"]],
|
|
46
|
+
["著", "either", ["zhuo2", "zhao1"]],
|
|
47
|
+
["给", "second", ["ji3"]],
|
|
48
|
+
["給", "second", ["ji3"]],
|
|
49
|
+
["更", "first", ["geng1"]],
|
|
50
|
+
["都", "second", ["du1"]],
|
|
51
|
+
["没", "first", ["mo4"]],
|
|
52
|
+
["沒", "first", ["mo4"]],
|
|
53
|
+
["间", "second", ["jian4"]],
|
|
54
|
+
["間", "second", ["jian4"]],
|
|
55
|
+
["赚", "first", ["zuan4"]],
|
|
56
|
+
["賺", "first", ["zuan4"]],
|
|
57
|
+
].map(([character, side, readings]) => [
|
|
58
|
+
character,
|
|
59
|
+
{ side, readings: readings.map((text) => readingOf(text)) },
|
|
60
|
+
]));
|
|
61
|
+
/**
|
|
62
|
+
* Whether the character at an index of a pair stands on a side.
|
|
63
|
+
*/
|
|
64
|
+
export function isOnSide(side, index) {
|
|
65
|
+
return side === "either" || (side === "first") === (index === 0);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=dominant-readings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dominant-readings.js","sourceRoot":"","sources":["../../src/decode/dominant-readings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAiB,MAAM,yBAAyB,CAAC;AAsBt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,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC;IACrC,SAAS;IACT,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;CAC5D,CAAC,CACH,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAU,EAAE,KAAa;IAChD,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type EdgeRule } from "./rules.js";
|
|
2
|
+
/**
|
|
3
|
+
* A pair nobody counted that reads a function word its rare way is taken off
|
|
4
|
+
* the lattice.
|
|
5
|
+
*
|
|
6
|
+
* The reading decode charges per edge, and that charge is what lets 地气 read
|
|
7
|
+
* `dì qì` against the 地 and 气 around it. The charge is the same for a pair
|
|
8
|
+
* no corpus counts. 破的 is CC-CEDICT's *to hit the target*, and it read
|
|
9
|
+
* 气球胀得太大,会破的 as `huì pò dì`. 更香 is `large_pinyin.txt`'s incense
|
|
10
|
+
* clock, 家给 is the 家给人足 of an idiom, 赚得 is that file's reading of a word
|
|
11
|
+
* CC-CEDICT reads `zhuàn dé`, and 上都 and 中都 are the capitals of two
|
|
12
|
+
* dynasties. Each sat in an everyday sentence and took its 的, 更, 给, 赚 or 都.
|
|
13
|
+
*
|
|
14
|
+
* Taking the edge away leaves each character to its own reading, which is the
|
|
15
|
+
* usual one. A counted word keeps its reading (目的, 首都, 京都), and so does a
|
|
16
|
+
* pair of more than two characters (知更鸟, 漫无目的地).
|
|
17
|
+
*
|
|
18
|
+
* Over 88,866 lines of Tatoeba and zh.wikipedia this changes 25 runs in the
|
|
19
|
+
* full tier, and all 25 are corrections. Over both CPP splits it changes 32,
|
|
20
|
+
* and two are wrong (官员俸给 and 北魏国都代郡). CPP's labelled accuracy holds
|
|
21
|
+
* at 91.86%. The standard and core tiers hold none of these pairs.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DOMINANT_READING: EdgeRule;
|
|
24
|
+
//# sourceMappingURL=dominant-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dominant-rule.d.ts","sourceRoot":"","sources":["../../src/decode/dominant-rule.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,KAAK,QAAQ,EAId,MAAM,YAAY,CAAC;AAiGpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAc9B,CAAC"}
|