@chaffjs/lang-en 0.29.0 → 0.30.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.
- package/dist/lexicons.d.ts.map +1 -1
- package/dist/lexicons.js +3 -0
- package/dist/lexicons.js.map +1 -1
- package/lexicons/formula-amount-word.yaml +13 -0
- package/lexicons/installment-label.yaml +14 -0
- package/lexicons/installment-word.yaml +25 -0
- package/lexicons/range-start-end.yaml +29 -0
- package/package.json +2 -2
- package/src/lexicons.ts +4 -0
package/dist/lexicons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicons.d.ts","sourceRoot":"","sources":["../src/lexicons.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"lexicons.d.ts","sourceRoot":"","sources":["../src/lexicons.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AA6B5D;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,MAAK,MAAY,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CASpE,CAAC"}
|
package/dist/lexicons.js
CHANGED
|
@@ -2,6 +2,7 @@ import { parse } from "yaml";
|
|
|
2
2
|
import { PACKAGE_DIR, joinPath, readDir, readText } from "./package-files.js";
|
|
3
3
|
const DIR = joinPath(PACKAGE_DIR, "lexicons");
|
|
4
4
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
const isStringList = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
5
6
|
const POSITIONS = ["before", "after"];
|
|
6
7
|
const toEntry = (raw) => {
|
|
7
8
|
if (!isRecord(raw) || typeof raw["pattern"] !== "string")
|
|
@@ -10,6 +11,7 @@ const toEntry = (raw) => {
|
|
|
10
11
|
const instead = raw["instead_of"];
|
|
11
12
|
const rewrite = raw["rewrite"];
|
|
12
13
|
const group = raw["group"];
|
|
14
|
+
const genres = raw["genres"];
|
|
13
15
|
return {
|
|
14
16
|
pattern: raw["pattern"],
|
|
15
17
|
weight: typeof weight === "number" ? weight : undefined,
|
|
@@ -17,6 +19,7 @@ const toEntry = (raw) => {
|
|
|
17
19
|
position: POSITIONS.find((position) => position === raw["position"]),
|
|
18
20
|
rewrite: typeof rewrite === "string" ? rewrite : undefined,
|
|
19
21
|
...(typeof group === "string" ? { group } : {}),
|
|
22
|
+
...(isStringList(genres) ? { genres } : {}),
|
|
20
23
|
};
|
|
21
24
|
};
|
|
22
25
|
/**
|
package/dist/lexicons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicons.js","sourceRoot":"","sources":["../src/lexicons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAE9C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAE5I,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAC;AAE/C,MAAM,OAAO,GAAG,CAAC,GAAY,EAA4B,EAAE;IACzD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC3E,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;IAClC,MAA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AAC;KAC5C,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,GAAG,EAA2B,EAAE,CACzE,MAAM,CAAC,WAAW,CAChB,OAAO,CAAC,GAAG,CAAC;KACT,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KACxC,OAAO,CAAC,CAAC,IAAI,EAAuB,EAAE;IACrC,MAAM,GAAG,GAAY,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IACjG,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3F,CAAC,CAAC,CACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# The words of formula-amount-mismatch. rate-name stands between a rate and the amount it is of ("5% of the sale price");
|
|
2
|
+
# name-rate between the amount and its rate ("sale price × 5%"). plus comes before a fixed amount added to the rate's part
|
|
3
|
+
# ("plus $500"). not-included says a tax is left out although a word of inclusion stands in it ("tax not included").
|
|
4
|
+
id: formula-amount-word
|
|
5
|
+
language: en
|
|
6
|
+
entries:
|
|
7
|
+
- { pattern: of the, group: rate-name }
|
|
8
|
+
- { pattern: of, group: rate-name }
|
|
9
|
+
- { pattern: ×, group: name-rate }
|
|
10
|
+
- { pattern: plus, group: plus }
|
|
11
|
+
- { pattern: "+", group: plus }
|
|
12
|
+
- { pattern: not included, group: not-included }
|
|
13
|
+
- { pattern: not incl., group: not-included }
|
|
@@ -31,3 +31,17 @@ entries:
|
|
|
31
31
|
- { pattern: Total amount payable, group: total }
|
|
32
32
|
- { pattern: Total amount repayable, group: total }
|
|
33
33
|
- { pattern: Total repayable, group: total }
|
|
34
|
+
# numbered labels a table row or a list item of a series of instalments; {n} is its number (1st payment, Instalment 2,
|
|
35
|
+
# Second payment). final is the last one after the others, deposit a deposit listed as one of them. They are added up
|
|
36
|
+
# and compared with the fee stated in the same section ("The trip costs £300 per student").
|
|
37
|
+
- { pattern: "{n} payment", group: numbered }
|
|
38
|
+
- { pattern: "{n} instalment", group: numbered }
|
|
39
|
+
- { pattern: "{n} installment", group: numbered }
|
|
40
|
+
- { pattern: "Payment {n}", group: numbered }
|
|
41
|
+
- { pattern: "Instalment {n}", group: numbered }
|
|
42
|
+
- { pattern: "Installment {n}", group: numbered }
|
|
43
|
+
- { pattern: Final payment, group: final }
|
|
44
|
+
- { pattern: Final instalment, group: final }
|
|
45
|
+
- { pattern: Final installment, group: final }
|
|
46
|
+
- { pattern: Last payment, group: final }
|
|
47
|
+
- { pattern: Deposit, group: deposit }
|
|
@@ -43,3 +43,28 @@ entries:
|
|
|
43
43
|
- { pattern: residual, group: skip }
|
|
44
44
|
- { pattern: deferred, group: skip }
|
|
45
45
|
- { pattern: trade-in, group: skip }
|
|
46
|
+
# ordinal is a number written as a word in a numbered instalment (First payment), with its value. payment says a section
|
|
47
|
+
# is about paying instalments; one must stand in the section of the series. fee states the fee, and fee-link may stand
|
|
48
|
+
# between it and its amount ("The fee per student is $130").
|
|
49
|
+
- { pattern: first, weight: 1, group: ordinal }
|
|
50
|
+
- { pattern: second, weight: 2, group: ordinal }
|
|
51
|
+
- { pattern: third, weight: 3, group: ordinal }
|
|
52
|
+
- { pattern: fourth, weight: 4, group: ordinal }
|
|
53
|
+
- { pattern: fifth, weight: 5, group: ordinal }
|
|
54
|
+
- { pattern: sixth, weight: 6, group: ordinal }
|
|
55
|
+
- { pattern: seventh, weight: 7, group: ordinal }
|
|
56
|
+
- { pattern: eighth, weight: 8, group: ordinal }
|
|
57
|
+
- { pattern: ninth, weight: 9, group: ordinal }
|
|
58
|
+
- { pattern: tenth, weight: 10, group: ordinal }
|
|
59
|
+
- { pattern: payment, group: payment }
|
|
60
|
+
- { pattern: payments, group: payment }
|
|
61
|
+
- { pattern: instalment, group: payment }
|
|
62
|
+
- { pattern: instalments, group: payment }
|
|
63
|
+
- { pattern: installment, group: payment }
|
|
64
|
+
- { pattern: installments, group: payment }
|
|
65
|
+
- { pattern: costs, group: fee }
|
|
66
|
+
- { pattern: fee, group: fee }
|
|
67
|
+
- { pattern: per student, group: fee-link }
|
|
68
|
+
- { pattern: per pupil, group: fee-link }
|
|
69
|
+
- { pattern: per child, group: fee-link }
|
|
70
|
+
- { pattern: per person, group: fee-link }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# A period written with a start word and an end word in one sentence: "The term starts on 1 April 2026 and ends on
|
|
2
|
+
# 31 March 2027" (date-range-reversed). group start goes right before the first date, group end right before the second,
|
|
3
|
+
# and only a group joint word stands between them besides the end word. A sentence with two start words or two end words
|
|
4
|
+
# is not read: which date belongs to which period is not certain ("Phase 1 starts on … and Phase 2 starts on …").
|
|
5
|
+
id: range-start-end
|
|
6
|
+
language: en
|
|
7
|
+
entries:
|
|
8
|
+
- { pattern: starts on, group: start }
|
|
9
|
+
- { pattern: start on, group: start }
|
|
10
|
+
- { pattern: starting on, group: start }
|
|
11
|
+
- { pattern: begins on, group: start }
|
|
12
|
+
- { pattern: begin on, group: start }
|
|
13
|
+
- { pattern: beginning on, group: start }
|
|
14
|
+
- { pattern: commences on, group: start }
|
|
15
|
+
- { pattern: commence on, group: start }
|
|
16
|
+
- { pattern: commencing on, group: start }
|
|
17
|
+
- { pattern: ends on, group: end }
|
|
18
|
+
- { pattern: end on, group: end }
|
|
19
|
+
- { pattern: ending on, group: end }
|
|
20
|
+
- { pattern: expires on, group: end }
|
|
21
|
+
- { pattern: expire on, group: end }
|
|
22
|
+
- { pattern: expiring on, group: end }
|
|
23
|
+
- { pattern: terminates on, group: end }
|
|
24
|
+
- { pattern: terminate on, group: end }
|
|
25
|
+
- { pattern: terminating on, group: end }
|
|
26
|
+
- { pattern: and, group: joint }
|
|
27
|
+
- { pattern: ", and", group: joint }
|
|
28
|
+
- { pattern: and shall, group: joint }
|
|
29
|
+
- { pattern: and will, group: joint }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaffjs/lang-en",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "English language adapter for chaff",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "isamu",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"url": "git+https://github.com/isamu/lab.git",
|
|
42
42
|
"directory": "text/packages/lang-en"
|
|
43
43
|
},
|
|
44
|
-
"homepage": "https://github.
|
|
44
|
+
"homepage": "https://isamu.github.io/lab/en/",
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
}
|
package/src/lexicons.ts
CHANGED
|
@@ -6,6 +6,8 @@ const DIR = joinPath(PACKAGE_DIR, "lexicons");
|
|
|
6
6
|
|
|
7
7
|
const isRecord = (value: unknown): value is Record<string, unknown> => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
8
|
|
|
9
|
+
const isStringList = (value: unknown): value is string[] => Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
10
|
+
|
|
9
11
|
const POSITIONS = ["before", "after"] as const;
|
|
10
12
|
|
|
11
13
|
const toEntry = (raw: unknown): LexiconEntry | undefined => {
|
|
@@ -14,6 +16,7 @@ const toEntry = (raw: unknown): LexiconEntry | undefined => {
|
|
|
14
16
|
const instead = raw["instead_of"];
|
|
15
17
|
const rewrite = raw["rewrite"];
|
|
16
18
|
const group = raw["group"];
|
|
19
|
+
const genres = raw["genres"];
|
|
17
20
|
return {
|
|
18
21
|
pattern: raw["pattern"],
|
|
19
22
|
weight: typeof weight === "number" ? weight : undefined,
|
|
@@ -21,6 +24,7 @@ const toEntry = (raw: unknown): LexiconEntry | undefined => {
|
|
|
21
24
|
position: POSITIONS.find((position) => position === raw["position"]),
|
|
22
25
|
rewrite: typeof rewrite === "string" ? rewrite : undefined,
|
|
23
26
|
...(typeof group === "string" ? { group } : {}),
|
|
27
|
+
...(isStringList(genres) ? { genres } : {}),
|
|
24
28
|
};
|
|
25
29
|
};
|
|
26
30
|
|