@chaffjs/lang-en 0.22.0 → 0.23.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/browser/package-files.d.ts +6 -0
- package/dist/browser/package-files.d.ts.map +1 -0
- package/dist/browser/package-files.js +10 -0
- package/dist/browser/package-files.js.map +1 -0
- package/dist/browser/wink-modules.d.ts +3 -0
- package/dist/browser/wink-modules.d.ts.map +1 -0
- package/dist/browser/wink-modules.js +7 -0
- package/dist/browser/wink-modules.js.map +1 -0
- package/dist/dates.d.ts.map +1 -1
- package/dist/dates.js +54 -2
- package/dist/dates.js.map +1 -1
- package/dist/definitions.d.ts.map +1 -1
- package/dist/definitions.js +42 -2
- package/dist/definitions.js.map +1 -1
- package/dist/dictionary.d.ts.map +1 -1
- package/dist/dictionary.js +3 -5
- package/dist/dictionary.js.map +1 -1
- package/dist/lexicons.d.ts.map +1 -1
- package/dist/lexicons.js +4 -6
- package/dist/lexicons.js.map +1 -1
- package/dist/package-files.d.ts +7 -0
- package/dist/package-files.d.ts.map +1 -0
- package/dist/package-files.js +12 -0
- package/dist/package-files.js.map +1 -0
- package/dist/pos.d.ts.map +1 -1
- package/dist/pos.js +3 -4
- package/dist/pos.js.map +1 -1
- package/dist/wink-modules.d.ts +5 -0
- package/dist/wink-modules.d.ts.map +1 -0
- package/dist/wink-modules.js +8 -0
- package/dist/wink-modules.js.map +1 -0
- package/lexicons/breakdown-gap-joiner.yaml +8 -0
- package/lexicons/breakdown-phrase.yaml +11 -0
- package/lexicons/company-form.yaml +15 -0
- package/lexicons/concrete-deadline.yaml +19 -0
- package/lexicons/deadline-permission.yaml +7 -0
- package/lexicons/demonstrative-not-opener.yaml +125 -0
- package/lexicons/demonstrative-opener.yaml +10 -0
- package/lexicons/discount-word.yaml +10 -0
- package/lexicons/party-role.yaml +23 -0
- package/lexicons/party-short-name.yaml +7 -0
- package/lexicons/quote-attribution.yaml +21 -0
- package/lexicons/total-phrase.yaml +11 -0
- package/lexicons/vague-deadline.yaml +16 -0
- package/lexicons/year-reference.yaml +52 -0
- package/package.json +7 -1
- package/src/browser/package-files.ts +15 -0
- package/src/browser/wink-modules.ts +9 -0
- package/src/browser/wink.d.ts +10 -0
- package/src/dates.ts +56 -2
- package/src/definitions.ts +49 -2
- package/src/dictionary.ts +3 -5
- package/src/lexicons.ts +4 -6
- package/src/package-files.ts +16 -0
- package/src/pos.ts +3 -5
- package/src/wink-modules.ts +11 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PACKAGE_DIR: string;
|
|
2
|
+
/** Paths here are made only from PACKAGE_DIR and file names, so joining them needs no normalising. */
|
|
3
|
+
export declare const joinPath: (...parts: readonly string[]) => string;
|
|
4
|
+
export declare const readText: (path: string) => string;
|
|
5
|
+
export declare const readDir: (path: string) => string[];
|
|
6
|
+
//# sourceMappingURL=package-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-files.d.ts","sourceRoot":"","sources":["../../src/browser/package-files.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,QAAa,CAAC;AAEtC,sGAAsG;AACtG,eAAO,MAAM,QAAQ,GAAI,GAAG,OAAO,SAAS,MAAM,EAAE,KAAG,MAAyB,CAAC;AAEjF,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,MAA8B,CAAC;AAEvE,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAM,EAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { packageFiles } from "chaffjs/browser-files";
|
|
2
|
+
// package-files.ts in a build without a file system: this package's lexicons and word list from memory, rooted at
|
|
3
|
+
// /@chaffjs/lang-en.
|
|
4
|
+
const files = packageFiles("@chaffjs/lang-en");
|
|
5
|
+
export const PACKAGE_DIR = files.root;
|
|
6
|
+
/** Paths here are made only from PACKAGE_DIR and file names, so joining them needs no normalising. */
|
|
7
|
+
export const joinPath = (...parts) => parts.join("/");
|
|
8
|
+
export const readText = (path) => files.readText(path);
|
|
9
|
+
export const readDir = (path) => files.readDir(path);
|
|
10
|
+
//# sourceMappingURL=package-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-files.js","sourceRoot":"","sources":["../../src/browser/package-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,kHAAkH;AAClH,qBAAqB;AAErB,MAAM,KAAK,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC;AAEtC,sGAAsG;AACtG,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAwB,EAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAY,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wink-modules.d.ts","sourceRoot":"","sources":["../../src/browser/wink-modules.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,QAAO,OAA8B,CAAC;AAEhE,eAAO,MAAM,gBAAgB,QAAO,OAAsB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import winkPosTaggerModule from "wink-pos-tagger";
|
|
2
|
+
import winkLexicon from "wink-lexicon/src/lexicon.js";
|
|
3
|
+
// wink-modules.ts in a bundle: the tagger and its vocabulary bundled. The vocabulary is the module the tagger itself
|
|
4
|
+
// imports, so the bundle holds it once.
|
|
5
|
+
export const winkPosTagger = () => winkPosTaggerModule;
|
|
6
|
+
export const winkLexiconWords = () => winkLexicon;
|
|
7
|
+
//# sourceMappingURL=wink-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wink-modules.js","sourceRoot":"","sources":["../../src/browser/wink-modules.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,iBAAiB,CAAC;AAClD,OAAO,WAAW,MAAM,6BAA6B,CAAC;AAEtD,qHAAqH;AACrH,wCAAwC;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAY,EAAE,CAAC,mBAAmB,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAY,EAAE,CAAC,WAAW,CAAC"}
|
package/dist/dates.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AA6J9C,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,KAAG,OAAO,EAOD,CAAC"}
|
package/dist/dates.js
CHANGED
|
@@ -35,8 +35,59 @@ const monthYear = (text, at, end, month) => {
|
|
|
35
35
|
const value = [year, pad(String(month)), ...(before === undefined ? [] : [pad(before.day)])].join("-");
|
|
36
36
|
return { start: before?.start ?? at, end: end + found[0].length, attrs: { value } };
|
|
37
37
|
};
|
|
38
|
+
/** "March 5", not "March 5.5", "March 5:30" or "March 50". */
|
|
39
|
+
const DAY_AFTER = /^ (?<d>\d{1,2})(?:st|nd|rd|th)?(?![\w%]|[.,:]\d)/u;
|
|
40
|
+
const LAST_DAY = 31;
|
|
41
|
+
/** "Rule 3 May Apply", a title-case heading: "May" before a capitalised word may be the modal, not the month after a day. */
|
|
42
|
+
const MODAL_AFTER = /^May [A-Z]/u;
|
|
43
|
+
/** "SEP 2 form", "MAY 2 servers": a capitalised month with a day and no year is more often a code or a shout than a date. */
|
|
44
|
+
const ALL_CAPS = /^[A-Z]+$/u;
|
|
45
|
+
/** The days listed after the first, "March 5, 6 and 7, 2026": ", 6". */
|
|
46
|
+
const LISTED_DAYS = /^(?:,\s*\d{1,2}(?:st|nd|rd|th)?)*/u;
|
|
47
|
+
const LINK = /^,?\s*(?:[-–—]|to|through|until|till|and|or|&)\s*/u;
|
|
48
|
+
const LEADING_MONTH = /^[A-Z][a-z]{2,8}\.?\s+/u;
|
|
49
|
+
const LATER_DAY = /^\d{1,2}(?:st|nd|rd|th)?/u;
|
|
50
|
+
const TRAILING_MONTH = /^\s+[A-Z][a-z]{2,8}\.?/u;
|
|
51
|
+
const YEAR_NEXT = /^,?\s+\d{4}\b/u;
|
|
52
|
+
const YEAR_LATER_REACH = 60;
|
|
53
|
+
/** What follows a match of `pattern` at the start of `text`, or `text` itself when `pattern` is optional and absent. */
|
|
54
|
+
const after = (text, pattern, optional = false) => {
|
|
55
|
+
if (text === undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
const found = pattern.exec(text);
|
|
58
|
+
if (found === null)
|
|
59
|
+
return optional ? text : undefined;
|
|
60
|
+
return text.slice(found[0].length);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* "March 5 – 7, 2026", "5 March to 7 April 2026", "March 5, 6 and 7, 2026": the year written once, at the end of the
|
|
64
|
+
* range or the list, belongs to this date too, so it is not read as one without a year.
|
|
65
|
+
*/
|
|
66
|
+
const yearLater = (text) => {
|
|
67
|
+
const linked = after(after(text, LISTED_DAYS, true), LINK);
|
|
68
|
+
const day = after(after(linked, LEADING_MONTH, true), LATER_DAY);
|
|
69
|
+
const rest = after(day, TRAILING_MONTH, true);
|
|
70
|
+
return rest !== undefined && YEAR_NEXT.test(rest);
|
|
71
|
+
};
|
|
72
|
+
/** "2025 Dec 18" and "1872 February 4" (a citation's or an astronomer's order) carry their year in front; "Figure 3 5 May" is no date. */
|
|
73
|
+
const YEAR_OR_NUMBER_BEFORE = /\d,?\s*$/u;
|
|
74
|
+
const isDay = (day) => Number(day) >= 1 && Number(day) <= LAST_DAY;
|
|
75
|
+
/** "March 5" or "5 March" with no year → 03-05. */
|
|
76
|
+
const monthDay = (text, at, end, month) => {
|
|
77
|
+
const after = DAY_AFTER.exec(text.slice(end, end + 8));
|
|
78
|
+
const afterDay = after?.groups?.["d"];
|
|
79
|
+
const before = afterDay === undefined && !MODAL_AFTER.test(text.slice(at, end + 2)) ? dayBefore(text, at) : undefined;
|
|
80
|
+
const day = afterDay ?? before?.day;
|
|
81
|
+
const start = before?.start ?? at;
|
|
82
|
+
if (day === undefined || !isDay(day) || YEAR_OR_NUMBER_BEFORE.test(text.slice(Math.max(0, start - 6), start)))
|
|
83
|
+
return undefined;
|
|
84
|
+
const dateEnd = after === null ? end : end + after[0].length;
|
|
85
|
+
if (yearLater(text.slice(dateEnd, dateEnd + YEAR_LATER_REACH)))
|
|
86
|
+
return undefined;
|
|
87
|
+
return { start, end: dateEnd, attrs: { value: `${pad(String(month))}-${pad(day)}` } };
|
|
88
|
+
};
|
|
38
89
|
/**
|
|
39
|
-
* A month name alone is not a date: "May" is also the modal verb, so it counts only with a year beside it.
|
|
90
|
+
* A month name alone is not a date: "May" is also the modal verb, so it counts only with a year beside it, or a day.
|
|
40
91
|
* The month is found first and its neighbours read with anchored patterns, never one long alternation.
|
|
41
92
|
*/
|
|
42
93
|
const namedDate = (text, match) => {
|
|
@@ -46,7 +97,8 @@ const namedDate = (text, match) => {
|
|
|
46
97
|
if (month === 0)
|
|
47
98
|
return undefined;
|
|
48
99
|
const end = match.index + match[0].length + (full === 0 && text.charAt(match.index + match[0].length) === "." ? 1 : 0);
|
|
49
|
-
|
|
100
|
+
const dated = monthDayYear(text, match.index, end, month) ?? monthYear(text, match.index, end, month);
|
|
101
|
+
return dated ?? (ALL_CAPS.test(match[0]) ? undefined : monthDay(text, match.index, end, month));
|
|
50
102
|
};
|
|
51
103
|
const hyphenatedDate = (match) => {
|
|
52
104
|
const month = ABBREVIATED.get((match.groups?.["month"] ?? "").toLowerCase());
|
package/dist/dates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.js","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":"AAEA,6DAA6D;AAE7D,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAC1I,qFAAqF;AACrF,MAAM,WAAW,GAAgC,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAU,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAChJ,2GAA2G;AAC3G,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAChE,gHAAgH;AAChH,MAAM,eAAe,GAAG,iFAAiF,CAAC;AAC1G,MAAM,QAAQ,GAAG,2CAA2C,CAAC;AAC7D,MAAM,UAAU,GAAG,kCAAkC,CAAC;AACtD,MAAM,cAAc,GAAG,kDAAkD,CAAC;AAC1E,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC,MAAM,GAAG,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAE9D,wDAAwD;AACxD,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAU,EAAgE,EAAE;IAC3G,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,I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|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAwB9C,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,OAAsC,CAAC;AAE3F,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,SACuC,CAAC;AAmErG,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,OAAO,EAC+D,CAAC"}
|
package/dist/definitions.js
CHANGED
|
@@ -2,7 +2,7 @@ import { CHAPTER_DEPTH, PART_DEPTH } from "./depth.js";
|
|
|
2
2
|
// Definitions in English documents, and how far a definition holds.
|
|
3
3
|
const DEFINITIONS = [
|
|
4
4
|
/["“](?<term>[^"”\n]{1,60})["”] (?:means|shall mean|refers to|has the meaning)\b/gu,
|
|
5
|
-
/\((?:the |hereinafter )?["“](?<term>[^"”\n]{1,60})["”]\)/gu,
|
|
5
|
+
/\((?:the |these |this |hereinafter |each,? an? |collectively,? the )?["“](?<term>[^"”\n]{1,60})["”]\)/gu,
|
|
6
6
|
/\(hereinafter referred to as ["“](?<term>[^"”\n]{1,60})["”]\)/gu,
|
|
7
7
|
];
|
|
8
8
|
/**
|
|
@@ -24,7 +24,46 @@ const POINTER = /^ has the meaning given (?:in|by)\b/u;
|
|
|
24
24
|
const isPointer = (text, end) => POINTER.test(text.slice(end - " has the meaning".length));
|
|
25
25
|
/** ("Seller") has no word that says it defines: the same parentheses quote an example ("silently fails"). */
|
|
26
26
|
const BARE = /^\(["“]/u;
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* A bracket that gives one thing several names: ("Pinecone", "we" or "us"), (the "Company", "we", "us", or "our"). The
|
|
29
|
+
* first name is the inline definition (it follows the long name); the others are defined there too.
|
|
30
|
+
*/
|
|
31
|
+
const BRACKET = /\((?<inside>[^()\n]{1,300})\)/gu;
|
|
32
|
+
const QUOTED_NAME = /["“](?<term>[^"”\n]{1,60})["”]/gu;
|
|
33
|
+
/** What may come before the first name: (the "Company", (each, a "Party", (collectively, the "Parties". */
|
|
34
|
+
const LIST_LEAD = /^(?:the |collectively,? the |each,? an? )?$/u;
|
|
35
|
+
/** What may come between two names: a comma, and or or, and the. */
|
|
36
|
+
const LIST_JOINT = /^(?:, (?:and |or )?| and | or )(?:the )?$/u;
|
|
37
|
+
/** A list of names starts with a capitalised one ("Pinecone"); ("mine", "not mine", "yours") quotes examples. */
|
|
38
|
+
const CAPITALISED = /^\p{Lu}/u;
|
|
39
|
+
/** The quoted names of a bracket that holds nothing but two or more names, joined as a list; otherwise none. */
|
|
40
|
+
const namesInList = (inside) => {
|
|
41
|
+
const names = [...inside.matchAll(QUOTED_NAME)].map((match) => ({
|
|
42
|
+
term: match.groups?.["term"] ?? "",
|
|
43
|
+
start: match.index,
|
|
44
|
+
end: match.index + match[0].length,
|
|
45
|
+
}));
|
|
46
|
+
const [first] = names;
|
|
47
|
+
if (first === undefined || names.length < 2 || !CAPITALISED.test(first.term) || !LIST_LEAD.test(inside.slice(0, first.start)))
|
|
48
|
+
return [];
|
|
49
|
+
const joined = names.slice(1).every((name, index) => LIST_JOINT.test(inside.slice(names[index]?.end ?? 0, name.start)));
|
|
50
|
+
return joined && inside.slice(names.at(-1)?.end ?? 0) === "" ? names : [];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A bracket that gives one thing several names: ("Pinecone", "we" or "us"), (the "Company", "we", "us", or "our"). The
|
|
54
|
+
* first name is the inline definition (it follows the long name); the others are defined there too.
|
|
55
|
+
*/
|
|
56
|
+
const nameListDefinitions = (text) => [...text.matchAll(BRACKET)].flatMap((match) => {
|
|
57
|
+
const inside = match.groups?.["inside"] ?? "";
|
|
58
|
+
const bare = BARE.test(match[0]) ? { form: "bare" } : {};
|
|
59
|
+
const scope = APPLIES.test(text) ? { scope: "local" } : {};
|
|
60
|
+
return namesInList(inside).map((name, index) => {
|
|
61
|
+
const start = index === 0 ? match.index : match.index + 1 + name.start;
|
|
62
|
+
const end = index === 0 ? match.index + match[0].length : match.index + 1 + name.end;
|
|
63
|
+
return { start, end, attrs: { term: name.term, ...scope, ...(index === 0 ? { placement: "inline" } : {}), ...bare } };
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const patternDefinitions = (text) => DEFINITIONS.flatMap((pattern) => [...text.matchAll(pattern)].flatMap((match) => {
|
|
28
67
|
const term = match.groups?.["term"];
|
|
29
68
|
if (term === undefined)
|
|
30
69
|
return [];
|
|
@@ -35,4 +74,5 @@ export const definitions = (text) => DEFINITIONS.flatMap((pattern) => [...text.m
|
|
|
35
74
|
const bare = BARE.test(match[0]) ? { form: "bare" } : {};
|
|
36
75
|
return [{ start: match.index, end, attrs: { term, ...scope, ...(inline ? { placement: "inline" } : {}), ...bare } }];
|
|
37
76
|
}));
|
|
77
|
+
export const definitions = (text) => [...patternDefinitions(text), ...nameListDefinitions(text)].toSorted((left, right) => left.start - right.start);
|
|
38
78
|
//# sourceMappingURL=definitions.js.map
|
package/dist/definitions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,oEAAoE;AAEpE,MAAM,WAAW,GAAG;IAClB,mFAAmF;IACnF,
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,oEAAoE;AAEpE,MAAM,WAAW,GAAG;IAClB,mFAAmF;IACnF,yGAAyG;IACzG,iEAAiE;CAClE,CAAC;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAG,+GAA+G,CAAC;AACzI,iHAAiH;AACjH,MAAM,OAAO,GAAG,2BAA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AK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC"}
|
package/dist/dictionary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../src/dictionary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../src/dictionary.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,QAAO,WAAW,CAAC,MAAM,CAQ/C,CAAC"}
|
package/dist/dictionary.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
1
|
+
import { PACKAGE_DIR, joinPath, readText } from "./package-files.js";
|
|
4
2
|
// The English word list (lexicons/dictionary.txt, built by scripts/en-dictionary.ts). It is large, so it is read only
|
|
5
3
|
// when a rule asks for it, and once.
|
|
6
|
-
const FILE =
|
|
4
|
+
const FILE = joinPath(PACKAGE_DIR, "lexicons", "dictionary.txt");
|
|
7
5
|
const loaded = { words: undefined };
|
|
8
6
|
const wordsIn = (text) => new Set(text.split("\n").filter((line) => line !== "" && !line.startsWith("#")));
|
|
9
7
|
export const dictionary = () => {
|
|
10
8
|
if (loaded.words !== undefined)
|
|
11
9
|
return loaded.words;
|
|
12
10
|
try {
|
|
13
|
-
loaded.words = wordsIn(
|
|
11
|
+
loaded.words = wordsIn(readText(FILE));
|
|
14
12
|
}
|
|
15
13
|
catch (error) {
|
|
16
14
|
throw new Error(`${FILE}: cannot read the English word list`, { cause: error });
|
package/dist/dictionary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../src/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../src/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAErE,sHAAsH;AACtH,qCAAqC;AAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;AAEjE,MAAM,MAAM,GAA+C,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAEhF,MAAM,OAAO,GAAG,CAAC,IAAY,EAAuB,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAExI,MAAM,CAAC,MAAM,UAAU,GAAG,GAAwB,EAAE;IAClD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,qCAAqC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC,CAAC"}
|
package/dist/lexicons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicons.d.ts","sourceRoot":"","sources":["../src/lexicons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lexicons.d.ts","sourceRoot":"","sources":["../src/lexicons.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AAyB5D;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,MAAK,MAAY,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CASpE,CAAC"}
|
package/dist/lexicons.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
1
|
import { parse } from "yaml";
|
|
5
|
-
|
|
2
|
+
import { PACKAGE_DIR, joinPath, readDir, readText } from "./package-files.js";
|
|
3
|
+
const DIR = joinPath(PACKAGE_DIR, "lexicons");
|
|
6
4
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
5
|
const POSITIONS = ["before", "after"];
|
|
8
6
|
const toEntry = (raw) => {
|
|
@@ -25,10 +23,10 @@ const toEntry = (raw) => {
|
|
|
25
23
|
* 語彙表はアダプタが持つ。detector は共通で、これだけが言語別。spec §11。
|
|
26
24
|
* 新しい言語のサポートは、ここを書くところから始まる。
|
|
27
25
|
*/
|
|
28
|
-
export const loadLexicons = (dir = DIR) => Object.fromEntries(
|
|
26
|
+
export const loadLexicons = (dir = DIR) => Object.fromEntries(readDir(dir)
|
|
29
27
|
.filter((file) => file.endsWith(".yaml"))
|
|
30
28
|
.flatMap((file) => {
|
|
31
|
-
const raw = parse(
|
|
29
|
+
const raw = parse(readText(joinPath(dir, file)));
|
|
32
30
|
if (!isRecord(raw) || typeof raw["id"] !== "string" || !Array.isArray(raw["entries"]))
|
|
33
31
|
return [];
|
|
34
32
|
return [[raw["id"], raw["entries"].map(toEntry).filter((entry) => entry !== undefined)]];
|
package/dist/lexicons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicons.js","sourceRoot":"","sources":["../src/lexicons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lexicons.js","sourceRoot":"","sources":["../src/lexicons.ts"],"names":[],"mappings":"AAAA,OA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O,CAAC,CAAC,CAAC,SAAS;QAC1D,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD,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,7 @@
|
|
|
1
|
+
/** The package's folder: src/ and dist/ both sit right under it. */
|
|
2
|
+
export declare const PACKAGE_DIR: string;
|
|
3
|
+
/** node:path join, for the paths read here. */
|
|
4
|
+
export declare const joinPath: (...parts: readonly string[]) => string;
|
|
5
|
+
export declare const readText: (path: string) => string;
|
|
6
|
+
export declare const readDir: (path: string) => string[];
|
|
7
|
+
//# sourceMappingURL=package-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-files.d.ts","sourceRoot":"","sources":["../src/package-files.ts"],"names":[],"mappings":"AAOA,oEAAoE;AACpE,eAAO,MAAM,WAAW,QAAsD,CAAC;AAE/E,+CAA+C;AAC/C,eAAO,MAAM,QAAQ,GAAI,GAAG,OAAO,SAAS,MAAM,EAAE,KAAG,MAAwB,CAAC;AAEhF,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,MAAoC,CAAC;AAE7E,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAM,EAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
// Every read of a file this package ships (lexicons, the word list) goes through here, so a build without a file
|
|
5
|
+
// system can put its own reads in this module's place.
|
|
6
|
+
/** The package's folder: src/ and dist/ both sit right under it. */
|
|
7
|
+
export const PACKAGE_DIR = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
/** node:path join, for the paths read here. */
|
|
9
|
+
export const joinPath = (...parts) => join(...parts);
|
|
10
|
+
export const readText = (path) => readFileSync(path, "utf8");
|
|
11
|
+
export const readDir = (path) => readdirSync(path);
|
|
12
|
+
//# sourceMappingURL=package-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-files.js","sourceRoot":"","sources":["../src/package-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,iHAAiH;AACjH,uDAAuD;AAEvD,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAE/E,+CAA+C;AAC/C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAwB,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAY,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/pos.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pos.d.ts","sourceRoot":"","sources":["../src/pos.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pos.d.ts","sourceRoot":"","sources":["../src/pos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAkF5C,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,KAAG,MAAiE,CAAC;AAkJrG,eAAO,MAAM,OAAO,QAAO,IAI1B,CAAC;AAEF,eAAO,MAAM,OAAO,QAAO,OAAoC,CAAC;AA2ChE,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,KAAK,EAAE,GAAG,SAMjD,CAAC"}
|
package/dist/pos.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import { straightApostrophes } from "./apostrophe.js";
|
|
3
2
|
import { loadLexicons } from "./lexicons.js";
|
|
4
3
|
import { blankLongRuns } from "./long-runs.js";
|
|
@@ -6,7 +5,7 @@ import { lowercasedAt, properNounChecked, rereadAt, sentenceInitialCommonWord }
|
|
|
6
5
|
import { isStativeParticiple, stativeVocabulary } from "./stative-participle.js";
|
|
7
6
|
import { isEmphasisedAdverb } from "./emphasis.js";
|
|
8
7
|
import { gerundFeatures } from "./gerund.js";
|
|
9
|
-
|
|
8
|
+
import { winkLexiconWords, winkPosTagger } from "./wink-modules.js";
|
|
10
9
|
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
11
10
|
const isCallable = (value) => typeof value === "function";
|
|
12
11
|
const isTagged = (value) => isRecord(value) && typeof value["value"] === "string" && typeof value["pos"] === "string";
|
|
@@ -19,7 +18,7 @@ const callMethod = (owner, name, args) => {
|
|
|
19
18
|
return Reflect.apply(method, owner, args);
|
|
20
19
|
};
|
|
21
20
|
const build = () => {
|
|
22
|
-
const factory =
|
|
21
|
+
const factory = winkPosTagger();
|
|
23
22
|
if (!isCallable(factory))
|
|
24
23
|
throw new Error("wink-pos-tagger が関数を export していません");
|
|
25
24
|
const tagger = factory();
|
|
@@ -182,7 +181,7 @@ const featuresOf = (tagged, at) => {
|
|
|
182
181
|
};
|
|
183
182
|
const isTags = (value) => Array.isArray(value) && value.every((tag) => typeof tag === "string");
|
|
184
183
|
const buildVocabulary = () => {
|
|
185
|
-
const words =
|
|
184
|
+
const words = winkLexiconWords();
|
|
186
185
|
if (!isRecord(words))
|
|
187
186
|
throw new Error("wink-lexicon の語彙が object ではありません");
|
|
188
187
|
return (word) => {
|
package/dist/pos.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pos.js","sourceRoot":"","sources":["../src/pos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO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C,CAAC;AAC1F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAuB,EAAE;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;IAC3B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC3C,qDAAqD;IACrD,MAAM,KAAK,GAAG,mBAAmB,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC,KAAK,EAAE,uBAAuB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** wink is CommonJS and holds its dictionary synchronously: from ESM it is taken with createRequire. */
|
|
2
|
+
export declare const winkPosTagger: () => unknown;
|
|
3
|
+
/** The vocabulary the tagger reads (word → Penn Treebank tags): the one wink-pos-tagger loads from its own dependency. */
|
|
4
|
+
export declare const winkLexiconWords: () => unknown;
|
|
5
|
+
//# sourceMappingURL=wink-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wink-modules.d.ts","sourceRoot":"","sources":["../src/wink-modules.ts"],"names":[],"mappings":"AAMA,wGAAwG;AACxG,eAAO,MAAM,aAAa,QAAO,OAAqC,CAAC;AAEvE,0HAA0H;AAC1H,eAAO,MAAM,gBAAgB,QAAO,OAA2F,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
// Where the wink tagger and its vocabulary come from. A build without a file system puts its own module in this one's place.
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
/** wink is CommonJS and holds its dictionary synchronously: from ESM it is taken with createRequire. */
|
|
5
|
+
export const winkPosTagger = () => require("wink-pos-tagger");
|
|
6
|
+
/** The vocabulary the tagger reads (word → Penn Treebank tags): the one wink-pos-tagger loads from its own dependency. */
|
|
7
|
+
export const winkLexiconWords = () => createRequire(require.resolve("wink-pos-tagger"))("wink-lexicon/src/lexicon.js");
|
|
8
|
+
//# sourceMappingURL=wink-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wink-modules.js","sourceRoot":"","sources":["../src/wink-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,6HAA6H;AAE7H,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,wGAAwG;AACxG,MAAM,CAAC,MAAM,aAAa,GAAG,GAAY,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEvE,0HAA0H;AAC1H,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAY,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Words that, between an amount and a breakdown phrase (consisting of), show the amount belongs to another item and is not the total
|
|
2
|
+
# the breakdown adds up to ("a $1,000 onboarding fee and a monthly subscription, consisting of ...").
|
|
3
|
+
id: breakdown-gap-joiner
|
|
4
|
+
language: en
|
|
5
|
+
entries:
|
|
6
|
+
- pattern: " and "
|
|
7
|
+
- pattern: " or "
|
|
8
|
+
- pattern: ";"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Words the items of a total follow directly in a sentence ("$8 per month, made up of a base fee of $6 and a storage fee of $2").
|
|
2
|
+
# total-mismatch takes the amount just before them as the total. "Including" is left out: it names a part, not every part.
|
|
3
|
+
id: breakdown-phrase
|
|
4
|
+
language: en
|
|
5
|
+
entries:
|
|
6
|
+
- pattern: made up of
|
|
7
|
+
- pattern: consisting of
|
|
8
|
+
- pattern: consists of
|
|
9
|
+
- pattern: comprising
|
|
10
|
+
- pattern: broken down as
|
|
11
|
+
- pattern: broken down into
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Forms that end a company name. Right before a short name in brackets, they show the short name is a party's (party-role-name).
|
|
2
|
+
id: company-form
|
|
3
|
+
language: en
|
|
4
|
+
entries:
|
|
5
|
+
- pattern: Ltd
|
|
6
|
+
- pattern: Limited
|
|
7
|
+
- pattern: Inc
|
|
8
|
+
- pattern: Incorporated
|
|
9
|
+
- pattern: LLC
|
|
10
|
+
- pattern: LLP
|
|
11
|
+
- pattern: Corporation
|
|
12
|
+
- pattern: Corp
|
|
13
|
+
- pattern: plc
|
|
14
|
+
- pattern: PLC
|
|
15
|
+
- pattern: GmbH
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# How a time limit stated as a number is written. A sentence holding one has a deadline, and vague-deadline leaves it; the
|
|
2
|
+
# document's count of these sentences is what its vague limits are compared with. "within … days" is a frame: "days" within
|
|
3
|
+
# a few words after "within". A bare unit ("24 hours a day", "on business days") is not a deadline, so units stand only in frames.
|
|
4
|
+
id: concrete-deadline
|
|
5
|
+
language: en
|
|
6
|
+
entries:
|
|
7
|
+
- pattern: within … day
|
|
8
|
+
- pattern: within … hours
|
|
9
|
+
- pattern: within … week
|
|
10
|
+
- pattern: within … month
|
|
11
|
+
- pattern: no later than
|
|
12
|
+
- pattern: business day of
|
|
13
|
+
- pattern: days of
|
|
14
|
+
- pattern: days after
|
|
15
|
+
- pattern: days before
|
|
16
|
+
- pattern: days prior
|
|
17
|
+
- pattern: days following
|
|
18
|
+
- pattern: days from
|
|
19
|
+
- pattern: days' notice
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Words that make a sentence a right rather than a duty ("We may promptly suspend your account"). A vague limit in such a
|
|
2
|
+
# sentence sets no deadline anyone must meet, so vague-deadline leaves it.
|
|
3
|
+
id: deadline-permission
|
|
4
|
+
language: en
|
|
5
|
+
entries:
|
|
6
|
+
- pattern: may
|
|
7
|
+
- pattern: can
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Openings with This, That or It that do not point back at the sentence before: the document itself ("This Agreement
|
|
2
|
+
# may be modified…", "This section explains…"), an "it" that stands for what follows ("It is worth noting that…"), and a
|
|
3
|
+
# "that" that opens a clause ("That the plan failed is clear"). An "it" before an adjective listed here is read as standing
|
|
4
|
+
# for what follows; one that points back there is missed, never misreported. demonstrative-opener-run does not count a
|
|
5
|
+
# sentence that opens with one.
|
|
6
|
+
id: demonstrative-not-opener
|
|
7
|
+
language: en
|
|
8
|
+
entries:
|
|
9
|
+
- pattern: this agreement
|
|
10
|
+
- pattern: these terms
|
|
11
|
+
- pattern: this document
|
|
12
|
+
- pattern: this section
|
|
13
|
+
- pattern: this subsection
|
|
14
|
+
- pattern: this chapter
|
|
15
|
+
- pattern: this part
|
|
16
|
+
- pattern: this article
|
|
17
|
+
- pattern: this policy
|
|
18
|
+
- pattern: this statement
|
|
19
|
+
- pattern: this notice
|
|
20
|
+
- pattern: this report
|
|
21
|
+
- pattern: this paper
|
|
22
|
+
- pattern: this page
|
|
23
|
+
- pattern: this guide
|
|
24
|
+
- pattern: this memo
|
|
25
|
+
- pattern: this specification
|
|
26
|
+
- pattern: this rfc
|
|
27
|
+
- pattern: this act
|
|
28
|
+
- pattern: this appendix
|
|
29
|
+
- pattern: it should be noted
|
|
30
|
+
- pattern: it seems
|
|
31
|
+
- pattern: it appears
|
|
32
|
+
- pattern: it turns out
|
|
33
|
+
- pattern: it is worth
|
|
34
|
+
- pattern: it was worth
|
|
35
|
+
- pattern: it is important
|
|
36
|
+
- pattern: it was important
|
|
37
|
+
- pattern: it is possible
|
|
38
|
+
- pattern: it was possible
|
|
39
|
+
- pattern: it is impossible
|
|
40
|
+
- pattern: it was impossible
|
|
41
|
+
- pattern: it is necessary
|
|
42
|
+
- pattern: it was necessary
|
|
43
|
+
- pattern: it is likely
|
|
44
|
+
- pattern: it was likely
|
|
45
|
+
- pattern: it is unlikely
|
|
46
|
+
- pattern: it was unlikely
|
|
47
|
+
- pattern: it is clear
|
|
48
|
+
- pattern: it was clear
|
|
49
|
+
- pattern: it is unclear
|
|
50
|
+
- pattern: it was unclear
|
|
51
|
+
- pattern: it is obvious
|
|
52
|
+
- pattern: it was obvious
|
|
53
|
+
- pattern: it is evident
|
|
54
|
+
- pattern: it was evident
|
|
55
|
+
- pattern: it is recommended
|
|
56
|
+
- pattern: it was recommended
|
|
57
|
+
- pattern: it is reasonable
|
|
58
|
+
- pattern: it was reasonable
|
|
59
|
+
- pattern: it is helpful
|
|
60
|
+
- pattern: it was helpful
|
|
61
|
+
- pattern: it is useful
|
|
62
|
+
- pattern: it was useful
|
|
63
|
+
- pattern: it is essential
|
|
64
|
+
- pattern: it was essential
|
|
65
|
+
- pattern: it is difficult
|
|
66
|
+
- pattern: it was difficult
|
|
67
|
+
- pattern: it is easy
|
|
68
|
+
- pattern: it was easy
|
|
69
|
+
- pattern: it is hard
|
|
70
|
+
- pattern: it was hard
|
|
71
|
+
- pattern: it is true
|
|
72
|
+
- pattern: it was true
|
|
73
|
+
- pattern: it is natural
|
|
74
|
+
- pattern: it was natural
|
|
75
|
+
- pattern: it is common
|
|
76
|
+
- pattern: it was common
|
|
77
|
+
- pattern: it is rare
|
|
78
|
+
- pattern: it was rare
|
|
79
|
+
- pattern: it is advisable
|
|
80
|
+
- pattern: it was advisable
|
|
81
|
+
- pattern: it is better
|
|
82
|
+
- pattern: it was better
|
|
83
|
+
- pattern: it is best
|
|
84
|
+
- pattern: it was best
|
|
85
|
+
- pattern: it is enough
|
|
86
|
+
- pattern: it was enough
|
|
87
|
+
- pattern: it is fair
|
|
88
|
+
- pattern: it was fair
|
|
89
|
+
- pattern: it is safe
|
|
90
|
+
- pattern: it was safe
|
|
91
|
+
- pattern: it is tempting
|
|
92
|
+
- pattern: it was tempting
|
|
93
|
+
- pattern: it is interesting
|
|
94
|
+
- pattern: it was interesting
|
|
95
|
+
- pattern: it is surprising
|
|
96
|
+
- pattern: it was surprising
|
|
97
|
+
- pattern: it is known
|
|
98
|
+
- pattern: it was known
|
|
99
|
+
- pattern: it is expected
|
|
100
|
+
- pattern: it was expected
|
|
101
|
+
- pattern: it is assumed
|
|
102
|
+
- pattern: it was assumed
|
|
103
|
+
- pattern: it is noted
|
|
104
|
+
- pattern: it was noted
|
|
105
|
+
- pattern: it's worth
|
|
106
|
+
- pattern: that the
|
|
107
|
+
- pattern: that a
|
|
108
|
+
- pattern: that an
|
|
109
|
+
- pattern: that it
|
|
110
|
+
- pattern: that this
|
|
111
|
+
- pattern: that these
|
|
112
|
+
- pattern: that there
|
|
113
|
+
- pattern: that we
|
|
114
|
+
- pattern: that they
|
|
115
|
+
- pattern: that he
|
|
116
|
+
- pattern: that she
|
|
117
|
+
- pattern: that i
|
|
118
|
+
- pattern: that you
|
|
119
|
+
- pattern: that our
|
|
120
|
+
- pattern: that their
|
|
121
|
+
- pattern: that such
|
|
122
|
+
- pattern: that no
|
|
123
|
+
- pattern: that any
|
|
124
|
+
- pattern: that some
|
|
125
|
+
- pattern: that all
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Sentence-opening words that point back (This, That, These, Those, It). demonstrative-opener-run counts the sentences in
|
|
2
|
+
# a row, in one paragraph, that open with one of these.
|
|
3
|
+
id: demonstrative-opener
|
|
4
|
+
language: en
|
|
5
|
+
entries:
|
|
6
|
+
- pattern: This
|
|
7
|
+
- pattern: That
|
|
8
|
+
- pattern: These
|
|
9
|
+
- pattern: Those
|
|
10
|
+
- pattern: It
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Words just before an amount that take it off a total ("a discount of $10"). total-mismatch subtracts it when it adds the items of a total in a sentence.
|
|
2
|
+
id: discount-word
|
|
3
|
+
language: en
|
|
4
|
+
entries:
|
|
5
|
+
- pattern: discount
|
|
6
|
+
- pattern: credit
|
|
7
|
+
- pattern: less
|
|
8
|
+
- pattern: minus
|
|
9
|
+
- pattern: deduction
|
|
10
|
+
- pattern: rebate
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Role words for a party to a contract. In a document that gave its parties short names, party-role-name points at one of
|
|
2
|
+
# these written instead, unless the document defines it. Words for people who are not parties (subcontractor) are left out.
|
|
3
|
+
id: party-role
|
|
4
|
+
language: en
|
|
5
|
+
entries:
|
|
6
|
+
- pattern: Service Provider
|
|
7
|
+
- pattern: Provider
|
|
8
|
+
- pattern: Supplier
|
|
9
|
+
- pattern: Vendor
|
|
10
|
+
- pattern: Contractor
|
|
11
|
+
- pattern: Customer
|
|
12
|
+
- pattern: Client
|
|
13
|
+
- pattern: Company
|
|
14
|
+
- pattern: Licensor
|
|
15
|
+
- pattern: Licensee
|
|
16
|
+
- pattern: Discloser
|
|
17
|
+
- pattern: Recipient
|
|
18
|
+
- pattern: Disclosing Party
|
|
19
|
+
- pattern: Receiving Party
|
|
20
|
+
- pattern: Buyer
|
|
21
|
+
- pattern: Seller
|
|
22
|
+
- pattern: Purchaser
|
|
23
|
+
- pattern: Operator
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Words that give a quotation to someone. A quotation in the same sentence is then someone's words, not the writer's own
|
|
2
|
+
# or a title (quote-without-source). position: before is a cue that stands before the quotation (according to X, "…"); the others
|
|
3
|
+
# stand on either side (X said, "…" / "…," X said).
|
|
4
|
+
id: quote-attribution
|
|
5
|
+
language: en
|
|
6
|
+
entries:
|
|
7
|
+
- pattern: said
|
|
8
|
+
- pattern: says
|
|
9
|
+
- pattern: once said
|
|
10
|
+
- pattern: wrote
|
|
11
|
+
- pattern: writes
|
|
12
|
+
- pattern: put it
|
|
13
|
+
- pattern: puts it
|
|
14
|
+
- { pattern: according to, position: before }
|
|
15
|
+
- pattern: stated
|
|
16
|
+
- pattern: remarked
|
|
17
|
+
- pattern: famously
|
|
18
|
+
- { pattern: in the words of, position: before }
|
|
19
|
+
- pattern: quoted
|
|
20
|
+
- pattern: argued
|
|
21
|
+
- pattern: observed
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Words a total amount follows directly in a sentence ("for a total of $9,000"). total-mismatch compares the amount with the
|
|
2
|
+
# sum of the items listed before the words. A total at the start of a list or table line is total-label.
|
|
3
|
+
id: total-phrase
|
|
4
|
+
language: en
|
|
5
|
+
entries:
|
|
6
|
+
- pattern: a total of
|
|
7
|
+
- pattern: total of
|
|
8
|
+
- pattern: totaling
|
|
9
|
+
- pattern: totalling
|
|
10
|
+
- pattern: "in total:"
|
|
11
|
+
- pattern: "total:"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Time limits that leave the deadline to the reader. An obligation written with one of these alone cannot be shown to be met or
|
|
2
|
+
# missed (vague-deadline). "Immediately" means at once and leaves no period, so it is not here.
|
|
3
|
+
id: vague-deadline
|
|
4
|
+
language: en
|
|
5
|
+
entries:
|
|
6
|
+
- pattern: promptly
|
|
7
|
+
- pattern: as soon as practicable
|
|
8
|
+
- pattern: as soon as reasonably practicable
|
|
9
|
+
- pattern: as soon as possible
|
|
10
|
+
- pattern: within a reasonable time
|
|
11
|
+
- pattern: within a reasonable period
|
|
12
|
+
- pattern: without undue delay
|
|
13
|
+
- pattern: in a timely manner
|
|
14
|
+
- pattern: forthwith
|
|
15
|
+
- pattern: without delay
|
|
16
|
+
- pattern: without unreasonable delay
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Words beside a date that give its year in words. date-without-year does not report a yearless date with one of these
|
|
2
|
+
# next to it: "June 30 of that year" has a year, and "by April 15 each year" or "annually, by October 30" is every year's.
|
|
3
|
+
# An entry stands after the date unless it says before; one before may end a few characters short of the date.
|
|
4
|
+
id: year-reference
|
|
5
|
+
language: en
|
|
6
|
+
entries:
|
|
7
|
+
- pattern: of each year
|
|
8
|
+
position: after
|
|
9
|
+
- pattern: of every year
|
|
10
|
+
position: after
|
|
11
|
+
- pattern: each year
|
|
12
|
+
position: after
|
|
13
|
+
- pattern: every year
|
|
14
|
+
position: after
|
|
15
|
+
- pattern: annually
|
|
16
|
+
position: after
|
|
17
|
+
- pattern: of that year
|
|
18
|
+
position: after
|
|
19
|
+
- pattern: of the same year
|
|
20
|
+
position: after
|
|
21
|
+
- pattern: of the following year
|
|
22
|
+
position: after
|
|
23
|
+
- pattern: of the next year
|
|
24
|
+
position: after
|
|
25
|
+
- pattern: of the previous year
|
|
26
|
+
position: after
|
|
27
|
+
- pattern: of the preceding year
|
|
28
|
+
position: after
|
|
29
|
+
- pattern: of this year
|
|
30
|
+
position: after
|
|
31
|
+
- pattern: of next year
|
|
32
|
+
position: after
|
|
33
|
+
- pattern: of last year
|
|
34
|
+
position: after
|
|
35
|
+
- pattern: of the fiscal year
|
|
36
|
+
position: after
|
|
37
|
+
- pattern: annually
|
|
38
|
+
position: before
|
|
39
|
+
- pattern: each year
|
|
40
|
+
position: before
|
|
41
|
+
- pattern: every year
|
|
42
|
+
position: before
|
|
43
|
+
- pattern: that year
|
|
44
|
+
position: before
|
|
45
|
+
- pattern: the same year
|
|
46
|
+
position: before
|
|
47
|
+
- pattern: this year
|
|
48
|
+
position: before
|
|
49
|
+
- pattern: next year
|
|
50
|
+
position: before
|
|
51
|
+
- pattern: last year
|
|
52
|
+
position: before
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaffjs/lang-en",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "English language adapter for chaff",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "isamu",
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"browser": {
|
|
15
|
+
"./src/package-files.ts": "./src/browser/package-files.ts",
|
|
16
|
+
"./src/wink-modules.ts": "./src/browser/wink-modules.ts",
|
|
17
|
+
"./dist/package-files.js": "./dist/browser/package-files.js",
|
|
18
|
+
"./dist/wink-modules.js": "./dist/browser/wink-modules.js"
|
|
19
|
+
},
|
|
14
20
|
"files": [
|
|
15
21
|
"LICENSE",
|
|
16
22
|
"README.md",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { packageFiles } from "chaffjs/browser-files";
|
|
2
|
+
|
|
3
|
+
// package-files.ts in a build without a file system: this package's lexicons and word list from memory, rooted at
|
|
4
|
+
// /@chaffjs/lang-en.
|
|
5
|
+
|
|
6
|
+
const files = packageFiles("@chaffjs/lang-en");
|
|
7
|
+
|
|
8
|
+
export const PACKAGE_DIR = files.root;
|
|
9
|
+
|
|
10
|
+
/** Paths here are made only from PACKAGE_DIR and file names, so joining them needs no normalising. */
|
|
11
|
+
export const joinPath = (...parts: readonly string[]): string => parts.join("/");
|
|
12
|
+
|
|
13
|
+
export const readText = (path: string): string => files.readText(path);
|
|
14
|
+
|
|
15
|
+
export const readDir = (path: string): string[] => files.readDir(path);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import winkPosTaggerModule from "wink-pos-tagger";
|
|
2
|
+
import winkLexicon from "wink-lexicon/src/lexicon.js";
|
|
3
|
+
|
|
4
|
+
// wink-modules.ts in a bundle: the tagger and its vocabulary bundled. The vocabulary is the module the tagger itself
|
|
5
|
+
// imports, so the bundle holds it once.
|
|
6
|
+
|
|
7
|
+
export const winkPosTagger = (): unknown => winkPosTaggerModule;
|
|
8
|
+
|
|
9
|
+
export const winkLexiconWords = (): unknown => winkLexicon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// wink ships no types. The browser build imports these two CommonJS modules and reads them as unknown.
|
|
2
|
+
declare module "wink-pos-tagger" {
|
|
3
|
+
const factory: unknown;
|
|
4
|
+
export default factory;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module "wink-lexicon/src/lexicon.js" {
|
|
8
|
+
const words: unknown;
|
|
9
|
+
export default words;
|
|
10
|
+
}
|
package/src/dates.ts
CHANGED
|
@@ -41,8 +41,61 @@ const monthYear = (text: string, at: number, end: number, month: number): Mentio
|
|
|
41
41
|
return { start: before?.start ?? at, end: end + found[0].length, attrs: { value } };
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
/** "March 5", not "March 5.5", "March 5:30" or "March 50". */
|
|
45
|
+
const DAY_AFTER = /^ (?<d>\d{1,2})(?:st|nd|rd|th)?(?![\w%]|[.,:]\d)/u;
|
|
46
|
+
const LAST_DAY = 31;
|
|
47
|
+
/** "Rule 3 May Apply", a title-case heading: "May" before a capitalised word may be the modal, not the month after a day. */
|
|
48
|
+
const MODAL_AFTER = /^May [A-Z]/u;
|
|
49
|
+
/** "SEP 2 form", "MAY 2 servers": a capitalised month with a day and no year is more often a code or a shout than a date. */
|
|
50
|
+
const ALL_CAPS = /^[A-Z]+$/u;
|
|
51
|
+
/** The days listed after the first, "March 5, 6 and 7, 2026": ", 6". */
|
|
52
|
+
const LISTED_DAYS = /^(?:,\s*\d{1,2}(?:st|nd|rd|th)?)*/u;
|
|
53
|
+
const LINK = /^,?\s*(?:[-–—]|to|through|until|till|and|or|&)\s*/u;
|
|
54
|
+
const LEADING_MONTH = /^[A-Z][a-z]{2,8}\.?\s+/u;
|
|
55
|
+
const LATER_DAY = /^\d{1,2}(?:st|nd|rd|th)?/u;
|
|
56
|
+
const TRAILING_MONTH = /^\s+[A-Z][a-z]{2,8}\.?/u;
|
|
57
|
+
const YEAR_NEXT = /^,?\s+\d{4}\b/u;
|
|
58
|
+
const YEAR_LATER_REACH = 60;
|
|
59
|
+
|
|
60
|
+
/** What follows a match of `pattern` at the start of `text`, or `text` itself when `pattern` is optional and absent. */
|
|
61
|
+
const after = (text: string | undefined, pattern: RegExp, optional = false): string | undefined => {
|
|
62
|
+
if (text === undefined) return undefined;
|
|
63
|
+
const found = pattern.exec(text);
|
|
64
|
+
if (found === null) return optional ? text : undefined;
|
|
65
|
+
return text.slice(found[0].length);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* "March 5 – 7, 2026", "5 March to 7 April 2026", "March 5, 6 and 7, 2026": the year written once, at the end of the
|
|
70
|
+
* range or the list, belongs to this date too, so it is not read as one without a year.
|
|
71
|
+
*/
|
|
72
|
+
const yearLater = (text: string): boolean => {
|
|
73
|
+
const linked = after(after(text, LISTED_DAYS, true), LINK);
|
|
74
|
+
const day = after(after(linked, LEADING_MONTH, true), LATER_DAY);
|
|
75
|
+
const rest = after(day, TRAILING_MONTH, true);
|
|
76
|
+
return rest !== undefined && YEAR_NEXT.test(rest);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** "2025 Dec 18" and "1872 February 4" (a citation's or an astronomer's order) carry their year in front; "Figure 3 5 May" is no date. */
|
|
80
|
+
const YEAR_OR_NUMBER_BEFORE = /\d,?\s*$/u;
|
|
81
|
+
|
|
82
|
+
const isDay = (day: string): boolean => Number(day) >= 1 && Number(day) <= LAST_DAY;
|
|
83
|
+
|
|
84
|
+
/** "March 5" or "5 March" with no year → 03-05. */
|
|
85
|
+
const monthDay = (text: string, at: number, end: number, month: number): Mention | undefined => {
|
|
86
|
+
const after = DAY_AFTER.exec(text.slice(end, end + 8));
|
|
87
|
+
const afterDay = after?.groups?.["d"];
|
|
88
|
+
const before = afterDay === undefined && !MODAL_AFTER.test(text.slice(at, end + 2)) ? dayBefore(text, at) : undefined;
|
|
89
|
+
const day = afterDay ?? before?.day;
|
|
90
|
+
const start = before?.start ?? at;
|
|
91
|
+
if (day === undefined || !isDay(day) || YEAR_OR_NUMBER_BEFORE.test(text.slice(Math.max(0, start - 6), start))) return undefined;
|
|
92
|
+
const dateEnd = after === null ? end : end + after[0].length;
|
|
93
|
+
if (yearLater(text.slice(dateEnd, dateEnd + YEAR_LATER_REACH))) return undefined;
|
|
94
|
+
return { start, end: dateEnd, attrs: { value: `${pad(String(month))}-${pad(day)}` } };
|
|
95
|
+
};
|
|
96
|
+
|
|
44
97
|
/**
|
|
45
|
-
* A month name alone is not a date: "May" is also the modal verb, so it counts only with a year beside it.
|
|
98
|
+
* A month name alone is not a date: "May" is also the modal verb, so it counts only with a year beside it, or a day.
|
|
46
99
|
* The month is found first and its neighbours read with anchored patterns, never one long alternation.
|
|
47
100
|
*/
|
|
48
101
|
const namedDate = (text: string, match: RegExpExecArray): Mention | undefined => {
|
|
@@ -51,7 +104,8 @@ const namedDate = (text: string, match: RegExpExecArray): Mention | undefined =>
|
|
|
51
104
|
const month = full === 0 ? (ABBREVIATED.get(word) ?? 0) : full;
|
|
52
105
|
if (month === 0) return undefined;
|
|
53
106
|
const end = match.index + match[0].length + (full === 0 && text.charAt(match.index + match[0].length) === "." ? 1 : 0);
|
|
54
|
-
|
|
107
|
+
const dated = monthDayYear(text, match.index, end, month) ?? monthYear(text, match.index, end, month);
|
|
108
|
+
return dated ?? (ALL_CAPS.test(match[0]) ? undefined : monthDay(text, match.index, end, month));
|
|
55
109
|
};
|
|
56
110
|
|
|
57
111
|
const hyphenatedDate = (match: RegExpExecArray): Mention[] => {
|
package/src/definitions.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { CHAPTER_DEPTH, PART_DEPTH } from "./depth.ts";
|
|
|
5
5
|
|
|
6
6
|
const DEFINITIONS = [
|
|
7
7
|
/["“](?<term>[^"”\n]{1,60})["”] (?:means|shall mean|refers to|has the meaning)\b/gu,
|
|
8
|
-
/\((?:the |hereinafter )?["“](?<term>[^"”\n]{1,60})["”]\)/gu,
|
|
8
|
+
/\((?:the |these |this |hereinafter |each,? an? |collectively,? the )?["“](?<term>[^"”\n]{1,60})["”]\)/gu,
|
|
9
9
|
/\(hereinafter referred to as ["“](?<term>[^"”\n]{1,60})["”]\)/gu,
|
|
10
10
|
];
|
|
11
11
|
|
|
@@ -34,7 +34,51 @@ const isPointer = (text: string, end: number): boolean => POINTER.test(text.slic
|
|
|
34
34
|
/** ("Seller") has no word that says it defines: the same parentheses quote an example ("silently fails"). */
|
|
35
35
|
const BARE = /^\(["“]/u;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A bracket that gives one thing several names: ("Pinecone", "we" or "us"), (the "Company", "we", "us", or "our"). The
|
|
39
|
+
* first name is the inline definition (it follows the long name); the others are defined there too.
|
|
40
|
+
*/
|
|
41
|
+
const BRACKET = /\((?<inside>[^()\n]{1,300})\)/gu;
|
|
42
|
+
const QUOTED_NAME = /["“](?<term>[^"”\n]{1,60})["”]/gu;
|
|
43
|
+
/** What may come before the first name: (the "Company", (each, a "Party", (collectively, the "Parties". */
|
|
44
|
+
const LIST_LEAD = /^(?:the |collectively,? the |each,? an? )?$/u;
|
|
45
|
+
/** What may come between two names: a comma, and or or, and the. */
|
|
46
|
+
const LIST_JOINT = /^(?:, (?:and |or )?| and | or )(?:the )?$/u;
|
|
47
|
+
/** A list of names starts with a capitalised one ("Pinecone"); ("mine", "not mine", "yours") quotes examples. */
|
|
48
|
+
const CAPITALISED = /^\p{Lu}/u;
|
|
49
|
+
|
|
50
|
+
type QuotedName = { readonly term: string; readonly start: number; readonly end: number };
|
|
51
|
+
|
|
52
|
+
/** The quoted names of a bracket that holds nothing but two or more names, joined as a list; otherwise none. */
|
|
53
|
+
const namesInList = (inside: string): QuotedName[] => {
|
|
54
|
+
const names = [...inside.matchAll(QUOTED_NAME)].map((match) => ({
|
|
55
|
+
term: match.groups?.["term"] ?? "",
|
|
56
|
+
start: match.index,
|
|
57
|
+
end: match.index + match[0].length,
|
|
58
|
+
}));
|
|
59
|
+
const [first] = names;
|
|
60
|
+
if (first === undefined || names.length < 2 || !CAPITALISED.test(first.term) || !LIST_LEAD.test(inside.slice(0, first.start))) return [];
|
|
61
|
+
const joined = names.slice(1).every((name, index) => LIST_JOINT.test(inside.slice(names[index]?.end ?? 0, name.start)));
|
|
62
|
+
return joined && inside.slice(names.at(-1)?.end ?? 0) === "" ? names : [];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A bracket that gives one thing several names: ("Pinecone", "we" or "us"), (the "Company", "we", "us", or "our"). The
|
|
67
|
+
* first name is the inline definition (it follows the long name); the others are defined there too.
|
|
68
|
+
*/
|
|
69
|
+
const nameListDefinitions = (text: string): Mention[] =>
|
|
70
|
+
[...text.matchAll(BRACKET)].flatMap((match) => {
|
|
71
|
+
const inside = match.groups?.["inside"] ?? "";
|
|
72
|
+
const bare = BARE.test(match[0]) ? { form: "bare" } : {};
|
|
73
|
+
const scope = APPLIES.test(text) ? { scope: "local" } : {};
|
|
74
|
+
return namesInList(inside).map((name, index) => {
|
|
75
|
+
const start = index === 0 ? match.index : match.index + 1 + name.start;
|
|
76
|
+
const end = index === 0 ? match.index + match[0].length : match.index + 1 + name.end;
|
|
77
|
+
return { start, end, attrs: { term: name.term, ...scope, ...(index === 0 ? { placement: "inline" } : {}), ...bare } };
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const patternDefinitions = (text: string): Mention[] =>
|
|
38
82
|
DEFINITIONS.flatMap((pattern) =>
|
|
39
83
|
[...text.matchAll(pattern)].flatMap((match) => {
|
|
40
84
|
const term = match.groups?.["term"];
|
|
@@ -47,3 +91,6 @@ export const definitions = (text: string): Mention[] =>
|
|
|
47
91
|
return [{ start: match.index, end, attrs: { term, ...scope, ...(inline ? { placement: "inline" } : {}), ...bare } }];
|
|
48
92
|
}),
|
|
49
93
|
);
|
|
94
|
+
|
|
95
|
+
export const definitions = (text: string): Mention[] =>
|
|
96
|
+
[...patternDefinitions(text), ...nameListDefinitions(text)].toSorted((left, right) => left.start - right.start);
|
package/src/dictionary.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
1
|
+
import { PACKAGE_DIR, joinPath, readText } from "./package-files.ts";
|
|
4
2
|
|
|
5
3
|
// The English word list (lexicons/dictionary.txt, built by scripts/en-dictionary.ts). It is large, so it is read only
|
|
6
4
|
// when a rule asks for it, and once.
|
|
7
5
|
|
|
8
|
-
const FILE =
|
|
6
|
+
const FILE = joinPath(PACKAGE_DIR, "lexicons", "dictionary.txt");
|
|
9
7
|
|
|
10
8
|
const loaded: { words: ReadonlySet<string> | undefined } = { words: undefined };
|
|
11
9
|
|
|
@@ -14,7 +12,7 @@ const wordsIn = (text: string): ReadonlySet<string> => new Set(text.split("\n").
|
|
|
14
12
|
export const dictionary = (): ReadonlySet<string> => {
|
|
15
13
|
if (loaded.words !== undefined) return loaded.words;
|
|
16
14
|
try {
|
|
17
|
-
loaded.words = wordsIn(
|
|
15
|
+
loaded.words = wordsIn(readText(FILE));
|
|
18
16
|
} catch (error) {
|
|
19
17
|
throw new Error(`${FILE}: cannot read the English word list`, { cause: error });
|
|
20
18
|
}
|
package/src/lexicons.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
1
|
import { parse } from "yaml";
|
|
5
2
|
import type { Lexicon, LexiconEntry } from "chaffjs/plugin";
|
|
3
|
+
import { PACKAGE_DIR, joinPath, readDir, readText } from "./package-files.ts";
|
|
6
4
|
|
|
7
|
-
const DIR =
|
|
5
|
+
const DIR = joinPath(PACKAGE_DIR, "lexicons");
|
|
8
6
|
|
|
9
7
|
const isRecord = (value: unknown): value is Record<string, unknown> => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
8
|
|
|
@@ -32,10 +30,10 @@ const toEntry = (raw: unknown): LexiconEntry | undefined => {
|
|
|
32
30
|
*/
|
|
33
31
|
export const loadLexicons = (dir: string = DIR): Record<string, Lexicon> =>
|
|
34
32
|
Object.fromEntries(
|
|
35
|
-
|
|
33
|
+
readDir(dir)
|
|
36
34
|
.filter((file) => file.endsWith(".yaml"))
|
|
37
35
|
.flatMap((file): [string, Lexicon][] => {
|
|
38
|
-
const raw: unknown = parse(
|
|
36
|
+
const raw: unknown = parse(readText(joinPath(dir, file)));
|
|
39
37
|
if (!isRecord(raw) || typeof raw["id"] !== "string" || !Array.isArray(raw["entries"])) return [];
|
|
40
38
|
return [[raw["id"], raw["entries"].map(toEntry).filter((entry) => entry !== undefined)]];
|
|
41
39
|
}),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
// Every read of a file this package ships (lexicons, the word list) goes through here, so a build without a file
|
|
6
|
+
// system can put its own reads in this module's place.
|
|
7
|
+
|
|
8
|
+
/** The package's folder: src/ and dist/ both sit right under it. */
|
|
9
|
+
export const PACKAGE_DIR = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
10
|
+
|
|
11
|
+
/** node:path join, for the paths read here. */
|
|
12
|
+
export const joinPath = (...parts: readonly string[]): string => join(...parts);
|
|
13
|
+
|
|
14
|
+
export const readText = (path: string): string => readFileSync(path, "utf8");
|
|
15
|
+
|
|
16
|
+
export const readDir = (path: string): string[] => readdirSync(path);
|
package/src/pos.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import type { Token } from "chaffjs/plugin";
|
|
3
2
|
import { straightApostrophes } from "./apostrophe.ts";
|
|
4
3
|
import { loadLexicons } from "./lexicons.ts";
|
|
@@ -7,8 +6,7 @@ import { lowercasedAt, properNounChecked, rereadAt, sentenceInitialCommonWord }
|
|
|
7
6
|
import { isStativeParticiple, stativeVocabulary } from "./stative-participle.ts";
|
|
8
7
|
import { isEmphasisedAdverb } from "./emphasis.ts";
|
|
9
8
|
import { gerundFeatures } from "./gerund.ts";
|
|
10
|
-
|
|
11
|
-
const require = createRequire(import.meta.url);
|
|
9
|
+
import { winkLexiconWords, winkPosTagger } from "./wink-modules.ts";
|
|
12
10
|
|
|
13
11
|
/** wink は CommonJS で、辞書を同期に持つ。初期化は 130 ms ほど。 */
|
|
14
12
|
type Tagged = { readonly value: string; readonly pos: string; readonly lemma?: string };
|
|
@@ -31,7 +29,7 @@ const callMethod = (owner: Record<string, unknown>, name: string, args: readonly
|
|
|
31
29
|
};
|
|
32
30
|
|
|
33
31
|
const build = (): Tagger => {
|
|
34
|
-
const factory
|
|
32
|
+
const factory = winkPosTagger();
|
|
35
33
|
if (!isCallable(factory)) throw new Error("wink-pos-tagger が関数を export していません");
|
|
36
34
|
const tagger: unknown = factory();
|
|
37
35
|
if (!isRecord(tagger)) throw new Error("wink-pos-tagger が object を返しませんでした");
|
|
@@ -218,7 +216,7 @@ type Vocabulary = (word: string) => readonly string[] | undefined;
|
|
|
218
216
|
const isTags = (value: unknown): value is readonly string[] => Array.isArray(value) && value.every((tag) => typeof tag === "string");
|
|
219
217
|
|
|
220
218
|
const buildVocabulary = (): Vocabulary => {
|
|
221
|
-
const words
|
|
219
|
+
const words = winkLexiconWords();
|
|
222
220
|
if (!isRecord(words)) throw new Error("wink-lexicon の語彙が object ではありません");
|
|
223
221
|
return (word) => {
|
|
224
222
|
const tags = Object.hasOwn(words, word) ? words[word] : undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
// Where the wink tagger and its vocabulary come from. A build without a file system puts its own module in this one's place.
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
/** wink is CommonJS and holds its dictionary synchronously: from ESM it is taken with createRequire. */
|
|
8
|
+
export const winkPosTagger = (): unknown => require("wink-pos-tagger");
|
|
9
|
+
|
|
10
|
+
/** The vocabulary the tagger reads (word → Penn Treebank tags): the one wink-pos-tagger loads from its own dependency. */
|
|
11
|
+
export const winkLexiconWords = (): unknown => createRequire(require.resolve("wink-pos-tagger"))("wink-lexicon/src/lexicon.js");
|