chaffjs 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/derived/session-hours.d.ts +26 -0
- package/dist/derived/session-hours.d.ts.map +1 -0
- package/dist/derived/session-hours.js +29 -0
- package/dist/derived/session-hours.js.map +1 -0
- package/dist/derived/time-lengths.d.ts +37 -0
- package/dist/derived/time-lengths.d.ts.map +1 -0
- package/dist/derived/time-lengths.js +168 -0
- package/dist/derived/time-lengths.js.map +1 -0
- package/dist/derived/unit-counts.d.ts +7 -0
- package/dist/derived/unit-counts.d.ts.map +1 -0
- package/dist/derived/unit-counts.js +13 -0
- package/dist/derived/unit-counts.js.map +1 -0
- package/dist/derived/working-hours.d.ts +36 -0
- package/dist/derived/working-hours.d.ts.map +1 -0
- package/dist/derived/working-hours.js +55 -0
- package/dist/derived/working-hours.js.map +1 -0
- package/dist/detectors/acronym-expansion.d.ts +1 -1
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +46 -2
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts +44 -0
- package/dist/detectors/capitalised-term.d.ts.map +1 -0
- package/dist/detectors/capitalised-term.js +101 -0
- package/dist/detectors/capitalised-term.js.map +1 -0
- package/dist/detectors/date-outside-period.d.ts.map +1 -1
- package/dist/detectors/date-outside-period.js +4 -1
- package/dist/detectors/date-outside-period.js.map +1 -1
- package/dist/detectors/derived-numbers.d.ts +2 -0
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +72 -18
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +57 -10
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/party-order.d.ts +3 -0
- package/dist/detectors/party-order.d.ts.map +1 -0
- package/dist/detectors/party-order.js +46 -0
- package/dist/detectors/party-order.js.map +1 -0
- package/dist/detectors/registry/connection-time-short.d.ts +3 -0
- package/dist/detectors/registry/connection-time-short.d.ts.map +1 -0
- package/dist/detectors/registry/connection-time-short.js +3 -0
- package/dist/detectors/registry/connection-time-short.js.map +1 -0
- package/dist/detectors/registry/duration-product-mismatch.d.ts +3 -0
- package/dist/detectors/registry/duration-product-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/duration-product-mismatch.js +3 -0
- package/dist/detectors/registry/duration-product-mismatch.js.map +1 -0
- package/dist/detectors/registry/party-order.d.ts +3 -0
- package/dist/detectors/registry/party-order.d.ts.map +1 -0
- package/dist/detectors/registry/party-order.js +3 -0
- package/dist/detectors/registry/party-order.js.map +1 -0
- package/dist/detectors/registry/requirement-lists.d.ts +3 -0
- package/dist/detectors/registry/requirement-lists.d.ts.map +1 -0
- package/dist/detectors/registry/requirement-lists.js +3 -0
- package/dist/detectors/registry/requirement-lists.js.map +1 -0
- package/dist/detectors/registry/return-type.d.ts +3 -0
- package/dist/detectors/registry/return-type.d.ts.map +1 -0
- package/dist/detectors/registry/return-type.js +3 -0
- package/dist/detectors/registry/return-type.js.map +1 -0
- package/dist/detectors/requirement-lists.d.ts +3 -0
- package/dist/detectors/requirement-lists.d.ts.map +1 -0
- package/dist/detectors/requirement-lists.js +46 -0
- package/dist/detectors/requirement-lists.js.map +1 -0
- package/dist/detectors/return-type.d.ts +3 -0
- package/dist/detectors/return-type.d.ts.map +1 -0
- package/dist/detectors/return-type.js +24 -0
- package/dist/detectors/return-type.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +9 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/time-order.d.ts +1 -0
- package/dist/detectors/time-order.d.ts.map +1 -1
- package/dist/detectors/time-order.js +30 -4
- package/dist/detectors/time-order.js.map +1 -1
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +19 -3
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +4 -1
- package/dist/document.js.map +1 -1
- package/dist/facts/table-facts.d.ts +2 -0
- package/dist/facts/table-facts.d.ts.map +1 -1
- package/dist/facts/table-facts.js +2 -0
- package/dist/facts/table-facts.js.map +1 -1
- package/dist/name-variants.d.ts +6 -1
- package/dist/name-variants.d.ts.map +1 -1
- package/dist/name-variants.js +68 -0
- package/dist/name-variants.js.map +1 -1
- package/dist/name-word-order.d.ts +49 -0
- package/dist/name-word-order.d.ts.map +1 -0
- package/dist/name-word-order.js +114 -0
- package/dist/name-word-order.js.map +1 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/return-type.d.ts +33 -0
- package/dist/return-type.d.ts.map +1 -0
- package/dist/return-type.js +302 -0
- package/dist/return-type.js.map +1 -0
- package/dist/structure/connection-times.d.ts +56 -0
- package/dist/structure/connection-times.d.ts.map +1 -0
- package/dist/structure/connection-times.js +165 -0
- package/dist/structure/connection-times.js.map +1 -0
- package/dist/structure/date-order-tie.d.ts +13 -0
- package/dist/structure/date-order-tie.d.ts.map +1 -0
- package/dist/structure/date-order-tie.js +61 -0
- package/dist/structure/date-order-tie.js.map +1 -0
- package/dist/structure/date-order.d.ts +2 -2
- package/dist/structure/date-order.d.ts.map +1 -1
- package/dist/structure/date-order.js +26 -9
- package/dist/structure/date-order.js.map +1 -1
- package/dist/structure/date-outside-period.d.ts +6 -0
- package/dist/structure/date-outside-period.d.ts.map +1 -1
- package/dist/structure/date-outside-period.js +49 -3
- package/dist/structure/date-outside-period.js.map +1 -1
- package/dist/structure/date-range.d.ts +5 -2
- package/dist/structure/date-range.d.ts.map +1 -1
- package/dist/structure/date-range.js +37 -9
- package/dist/structure/date-range.js.map +1 -1
- package/dist/structure/leg-times.d.ts +2 -0
- package/dist/structure/leg-times.d.ts.map +1 -1
- package/dist/structure/leg-times.js +13 -0
- package/dist/structure/leg-times.js.map +1 -1
- package/dist/structure/party-order.d.ts +33 -0
- package/dist/structure/party-order.d.ts.map +1 -0
- package/dist/structure/party-order.js +79 -0
- package/dist/structure/party-order.js.map +1 -0
- package/dist/structure/requirement-lists.d.ts +37 -0
- package/dist/structure/requirement-lists.d.ts.map +1 -0
- package/dist/structure/requirement-lists.js +89 -0
- package/dist/structure/requirement-lists.js.map +1 -0
- package/dist/structure/time-order.d.ts +21 -0
- package/dist/structure/time-order.d.ts.map +1 -1
- package/dist/structure/time-order.js +5 -6
- package/dist/structure/time-order.js.map +1 -1
- package/dist/structure/version-order.d.ts +2 -0
- package/dist/structure/version-order.d.ts.map +1 -1
- package/dist/structure/version-order.js +10 -0
- package/dist/structure/version-order.js.map +1 -1
- package/dist/surname-near.d.ts +6 -0
- package/dist/surname-near.d.ts.map +1 -0
- package/dist/surname-near.js +31 -0
- package/dist/surname-near.js.map +1 -0
- package/dist/table-cells.d.ts +13 -0
- package/dist/table-cells.d.ts.map +1 -0
- package/dist/table-cells.js +36 -0
- package/dist/table-cells.js.map +1 -0
- package/dist/table-names.d.ts +42 -0
- package/dist/table-names.d.ts.map +1 -0
- package/dist/table-names.js +94 -0
- package/dist/table-names.js.map +1 -0
- package/package.json +3 -3
- package/rules/connection-time-short.yaml +52 -0
- package/rules/date-outside-period.yaml +4 -4
- package/rules/duration-mismatch.yaml +7 -4
- package/rules/duration-product-mismatch.yaml +73 -0
- package/rules/name-variant.yaml +8 -2
- package/rules/party-order.yaml +84 -0
- package/rules/required-listed-as-preferred.yaml +102 -0
- package/rules/return-type-mismatch.yaml +79 -0
- package/rules/undefined-term.yaml +21 -7
- package/src/derived/session-hours.ts +62 -0
- package/src/derived/time-lengths.ts +226 -0
- package/src/derived/unit-counts.ts +18 -0
- package/src/derived/working-hours.ts +97 -0
- package/src/detectors/acronym-expansion.ts +57 -2
- package/src/detectors/capitalised-term.ts +147 -0
- package/src/detectors/date-outside-period.ts +4 -1
- package/src/detectors/derived-numbers.ts +94 -21
- package/src/detectors/name-variant.ts +71 -13
- package/src/detectors/party-order.ts +50 -0
- package/src/detectors/registry/connection-time-short.ts +4 -0
- package/src/detectors/registry/duration-product-mismatch.ts +4 -0
- package/src/detectors/registry/party-order.ts +4 -0
- package/src/detectors/registry/requirement-lists.ts +4 -0
- package/src/detectors/registry/return-type.ts +4 -0
- package/src/detectors/requirement-lists.ts +65 -0
- package/src/detectors/return-type.ts +30 -0
- package/src/detectors/structure-tree.ts +12 -1
- package/src/detectors/time-order.ts +40 -5
- package/src/detectors/undefined-term.ts +20 -3
- package/src/document.ts +4 -1
- package/src/facts/table-facts.ts +3 -0
- package/src/name-variants.ts +76 -1
- package/src/name-word-order.ts +149 -0
- package/src/plugin.ts +5 -0
- package/src/return-type.ts +361 -0
- package/src/structure/connection-times.ts +226 -0
- package/src/structure/date-order-tie.ts +86 -0
- package/src/structure/date-order.ts +41 -14
- package/src/structure/date-outside-period.ts +72 -7
- package/src/structure/date-range.ts +45 -9
- package/src/structure/leg-times.ts +15 -0
- package/src/structure/party-order.ts +115 -0
- package/src/structure/requirement-lists.ts +145 -0
- package/src/structure/time-order.ts +8 -7
- package/src/structure/version-order.ts +10 -0
- package/src/surname-near.ts +31 -0
- package/src/table-cells.ts +41 -0
- package/src/table-names.ts +113 -0
|
@@ -20,6 +20,16 @@ const compareVersions = (left, right) => {
|
|
|
20
20
|
const differing = left.parts.findIndex((part, index) => part !== right.parts[index]);
|
|
21
21
|
return differing === -1 ? comparePrerelease(left.prerelease, right.prerelease) : Math.sign((left.parts[differing] ?? 0) - (right.parts[differing] ?? 0));
|
|
22
22
|
};
|
|
23
|
+
/** Whether every label is a version and no step goes against direction (equal versions do not break it). */
|
|
24
|
+
export const versionsAlong = (labels, direction) => {
|
|
25
|
+
const versions = labels.flatMap((label) => {
|
|
26
|
+
const version = label === undefined ? undefined : parse(label);
|
|
27
|
+
return version === undefined ? [] : [version];
|
|
28
|
+
});
|
|
29
|
+
if (versions.length !== labels.length)
|
|
30
|
+
return false;
|
|
31
|
+
return versions.slice(1).every((version, index) => compareVersions(version, versions[index] ?? version) !== -direction);
|
|
32
|
+
};
|
|
23
33
|
/** The longest run along direction ending at each version (equal versions do not break it). */
|
|
24
34
|
const longestEndingAt = (versions, direction) => versions.reduce((lengths, version, index) => {
|
|
25
35
|
const along = versions.slice(0, index).map((earlier, at) => (compareVersions(version, earlier) === -direction ? 0 : (lengths[at] ?? 0)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-order.js","sourceRoot":"","sources":["../../src/structure/version-order.ts"],"names":[],"mappings":"AAUA,4FAA4F;AAC5F,MAAM,aAAa,GAAG,6FAA6F,CAAC;AAEpH,2GAA2G;AAC3G,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAsB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEzG,MAAM,KAAK,GAAG,CAAC,KAAa,EAAuB,EAAE;IACnD,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;AAC3F,CAAC,CAAC;AAEF,oEAAoE;AACpE,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE;IAChE,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,CAAC,CAAC;IAC1B,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,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CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAyB,EAAW,EAAE;IACrE,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;IACnE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACvE,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surname-near.d.ts","sourceRoot":"","sources":["../src/surname-near.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,OAU3D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// 名が同じ人の名前の、姓だけの書き損じ(Whitford と Whitfield)。一字違い(isNearWord)より遠い違いを、英字の長い姓に限って見る。
|
|
2
|
+
const LATIN_WORD = /^[a-z]+$/u;
|
|
3
|
+
/** 二字違いまで見る姓の長さ。短い姓(Martin と Marten、Hansen と Hanson)は別の姓のことが多い。 */
|
|
4
|
+
const MIN_SURNAME_LENGTH = 7;
|
|
5
|
+
/** 頭からそろう字の数。頭が違えば別の姓(Robertson と Robinson)。 */
|
|
6
|
+
const MIN_SURNAME_PREFIX = 4;
|
|
7
|
+
/** 頭と終わりのそろった字のあいだに残る字の数。短いほうで二字まで、長いほうで三字まで(Whitford の or と Whitfield の iel)。 */
|
|
8
|
+
const MAX_SURNAME_GAP = 2;
|
|
9
|
+
const sharedPrefix = (left, right) => {
|
|
10
|
+
const differ = [...left].findIndex((char, index) => char !== right.charAt(index));
|
|
11
|
+
return differ < 0 ? left.length : differ;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 二つの英字の姓が、頭が四字以上そろい、終わりの字もそろい、あいだの二字(長いほうは三字)までだけ違うか。どちらも七字以上で。
|
|
15
|
+
* 終わりだけの違い(Whitford と Whitfords)は語の形の違い。
|
|
16
|
+
*/
|
|
17
|
+
export const isNearSurname = (left, right) => {
|
|
18
|
+
if (left === right || !LATIN_WORD.test(left) || !LATIN_WORD.test(right) || Math.min(left.length, right.length) < MIN_SURNAME_LENGTH)
|
|
19
|
+
return false;
|
|
20
|
+
const prefix = sharedPrefix(left, right);
|
|
21
|
+
if (prefix < MIN_SURNAME_PREFIX)
|
|
22
|
+
return false;
|
|
23
|
+
const [leftRest, rightRest] = [left.slice(prefix), right.slice(prefix)];
|
|
24
|
+
const suffix = sharedPrefix([...leftRest].toReversed().join(""), [...rightRest].toReversed().join(""));
|
|
25
|
+
if (suffix === 0)
|
|
26
|
+
return false;
|
|
27
|
+
const gaps = [leftRest.length - suffix, rightRest.length - suffix].toSorted((first, second) => first - second);
|
|
28
|
+
const [shorter = 0, longer = 0] = gaps;
|
|
29
|
+
return shorter <= MAX_SURNAME_GAP && longer <= MAX_SURNAME_GAP + 1;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=surname-near.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surname-near.js","sourceRoot":"","sources":["../src/surname-near.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,MAAM,UAAU,GAAG,WAAW,CAAC;AAE/B,mEAAmE;AACnE,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,gDAAgD;AAChD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,kFAAkF;AAClF,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,MAAM,YAAY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GAAG,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IAC/G,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IACvC,OAAO,OAAO,IAAI,eAAe,IAAI,MAAM,IAAI,eAAe,GAAG,CAAC,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProseDocument, Segmentation, Span, TableCell } from "./plugin.ts";
|
|
2
|
+
import { type Cell } from "./facts/table-facts.ts";
|
|
3
|
+
/** 升一つの語。字の無い升(数だけ、空)は解析しない。adapter が語を返さなければ tokens は無い。 */
|
|
4
|
+
export declare const cellWithTokens: (cell: Cell, segment: (text: string) => Segmentation) => TableCell;
|
|
5
|
+
/** 文書の表(引用とコードの外)の本体の升と、その語。 */
|
|
6
|
+
export declare const tableCellsOf: (doc: ProseDocument, segment: (text: string) => Segmentation) => TableCell[];
|
|
7
|
+
/** prose に、升の字だけを書き戻したもの(表の見出しの行と区切りの | は覆ったまま)。位置は変えない。 */
|
|
8
|
+
export declare const proseWithCells: (prose: string, cells: readonly (Span & {
|
|
9
|
+
readonly text: string;
|
|
10
|
+
})[]) => string;
|
|
11
|
+
/** 表の升の語は、読む rule があるときに一度だけ作る。升ごとの解析を、表を読まない rule に払わせない。 */
|
|
12
|
+
export declare const lazyCells: (make: () => readonly TableCell[]) => (() => readonly TableCell[]);
|
|
13
|
+
//# sourceMappingURL=table-cells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-cells.d.ts","sourceRoot":"","sources":["../src/table-cells.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAS,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAQnE,6DAA6D;AAC7D,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,KAAG,SAKpF,CAAC;AAEF,gCAAgC;AAChC,eAAO,MAAM,YAAY,GAAI,KAAK,aAAa,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,KAAG,SAAS,EAChB,CAAC;AAErF,4DAA4D;AAC5D,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,EAAE,OAAO,SAAS,CAAC,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,KAAG,MAWpG,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,SAAS,SAAS,EAAE,KAAG,CAAC,MAAM,SAAS,SAAS,EAAE,CAGvF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { proseAndTablesOf } from "./table-text.js";
|
|
2
|
+
import { tableBodyCells } from "./facts/table-facts.js";
|
|
3
|
+
// 表の升の語。本文は表を覆うので、升の字は文の分割も品詞解析も通らない。升ごとに adapter に渡し、語の位置を source の上に戻す。
|
|
4
|
+
const LETTER = /\p{L}/u;
|
|
5
|
+
const shiftToken = (token, by) => ({ ...token, span: { start: token.span.start + by, end: token.span.end + by } });
|
|
6
|
+
/** 升一つの語。字の無い升(数だけ、空)は解析しない。adapter が語を返さなければ tokens は無い。 */
|
|
7
|
+
export const cellWithTokens = (cell, segment) => {
|
|
8
|
+
if (!LETTER.test(cell.text))
|
|
9
|
+
return cell;
|
|
10
|
+
const sentences = segment(cell.text).sentences;
|
|
11
|
+
if (!sentences.some((sentence) => sentence.tokens !== undefined))
|
|
12
|
+
return cell;
|
|
13
|
+
return { ...cell, tokens: sentences.flatMap((sentence) => (sentence.tokens ?? []).map((token) => shiftToken(token, cell.start))) };
|
|
14
|
+
};
|
|
15
|
+
/** 文書の表(引用とコードの外)の本体の升と、その語。 */
|
|
16
|
+
export const tableCellsOf = (doc, segment) => tableBodyCells(proseAndTablesOf(doc)).map((cell) => cellWithTokens(cell, segment));
|
|
17
|
+
/** prose に、升の字だけを書き戻したもの(表の見出しの行と区切りの | は覆ったまま)。位置は変えない。 */
|
|
18
|
+
export const proseWithCells = (prose, cells) => {
|
|
19
|
+
const pieces = [];
|
|
20
|
+
const end = cells
|
|
21
|
+
.toSorted((left, right) => left.start - right.start)
|
|
22
|
+
.reduce((from, cell) => {
|
|
23
|
+
if (cell.start < from || cell.end - cell.start !== cell.text.length)
|
|
24
|
+
return from;
|
|
25
|
+
pieces.push(prose.slice(from, cell.start), cell.text);
|
|
26
|
+
return cell.end;
|
|
27
|
+
}, 0);
|
|
28
|
+
pieces.push(prose.slice(end));
|
|
29
|
+
return pieces.join("");
|
|
30
|
+
};
|
|
31
|
+
/** 表の升の語は、読む rule があるときに一度だけ作る。升ごとの解析を、表を読まない rule に払わせない。 */
|
|
32
|
+
export const lazyCells = (make) => {
|
|
33
|
+
const cells = {};
|
|
34
|
+
return () => (cells.value ??= make());
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=table-cells.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-cells.js","sourceRoot":"","sources":["../src/table-cells.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAa,MAAM,wBAAwB,CAAC;AAEnE,0EAA0E;AAE1E,MAAM,MAAM,GAAG,QAAQ,CAAC;AAExB,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,EAAU,EAAS,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC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,CAAC;SACnD,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACjF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,CAAC;IACR,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAgC,EAAgC,EAAE;IAC1F,MAAM,KAAK,GAAqC,EAAE,CAAC;IACnD,OAAO,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type NameMention } from "./name-variants.ts";
|
|
2
|
+
import type { TableCell, Token } from "./plugin.ts";
|
|
3
|
+
/** 表の升の名前。words は空白で分けた語。reading は升の語の読み(読めなければ無い)。 */
|
|
4
|
+
export type CellName = {
|
|
5
|
+
readonly surface: string;
|
|
6
|
+
readonly offset: number;
|
|
7
|
+
readonly words: readonly string[];
|
|
8
|
+
readonly reading?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
/** 本文の名前の書き方と、その数。reading は最初の現れの読み。 */
|
|
11
|
+
export type ProseName = {
|
|
12
|
+
readonly surface: string;
|
|
13
|
+
readonly words: readonly string[];
|
|
14
|
+
readonly count: number;
|
|
15
|
+
readonly reading?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export type CellNameVariant = {
|
|
18
|
+
readonly name: CellName;
|
|
19
|
+
readonly usual: string;
|
|
20
|
+
readonly kind: "spelling" | "reading" | "near";
|
|
21
|
+
};
|
|
22
|
+
/** 範囲の中の語の読みをつないだもの。記号と空白の語は読まない。読めない語があれば無い。 */
|
|
23
|
+
export declare const readingWithin: (tokens: readonly Token[], start: number, end: number) => string | undefined;
|
|
24
|
+
/** 名前の形をした升。升の字の前後の空白と強調の印は名前の外。 */
|
|
25
|
+
export declare const cellNamesIn: (cells: readonly TableCell[]) => CellName[];
|
|
26
|
+
/**
|
|
27
|
+
* 本文の名前の書き方ごとの数。空白一つで並んだ名前の現れ(佐々木 と 美穂)は、一つの名前(佐々木 美穂)としても数える。
|
|
28
|
+
* 日本語の解析器は姓と名のあいだの空白で名前を切る。
|
|
29
|
+
*/
|
|
30
|
+
export declare const proseNamesOf: (mentions: readonly NameMention[], source: string) => ProseName[];
|
|
31
|
+
/**
|
|
32
|
+
* 升の名前が、本文の名前の書き分けか。記号・幅・大小だけの違いか、語の数が同じで一語だけが違い、残りの語が同じとき。違う一語は、
|
|
33
|
+
* 英字なら一字違い、漢字・かなら名前全体の読みが同じ(本文の名前の見方と同じ)。この二つは、本文の形が二度以上、升の形が文書の
|
|
34
|
+
* 中で一度だけのとき(別の人のこともある)。
|
|
35
|
+
*/
|
|
36
|
+
export declare const cellNameRelation: (name: CellName, uses: number, prose: ProseName) => CellNameVariant["kind"] | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* 表の升の名前のうち、本文の名前の書き分けのもの。記号だけの違いを先に、その中で本文の形のうち一番多いものと比べる。
|
|
39
|
+
* 書き方ごとに最初の升を一つ。
|
|
40
|
+
*/
|
|
41
|
+
export declare const cellNameVariants: (names: readonly CellName[], prose: readonly ProseName[]) => CellNameVariant[];
|
|
42
|
+
//# sourceMappingURL=table-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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Q,MAAM,KAAG,SAAS,EAexF,CAAC;AAeF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,EAAE,MAAM,MAAM,EAAE,OAAO,SAAS,KAAG,eAAe,CAAC,MAAM,CAAC,GAAG,SAQ3G,CAAC;AAKF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,QAAQ,EAAE,EAAE,OAAO,SAAS,SAAS,EAAE,KAAG,eAAe,EAgBzG,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { isNearWord, nameKey } from "./name-variants.js";
|
|
2
|
+
import { withoutEdgeMarks } from "./facts/trim-marks.js";
|
|
3
|
+
/** 英字の名前の升: 大文字で始まる語が二つから四つ。小文字の語(Write the procedure)を含む升は名前でない。 */
|
|
4
|
+
const LATIN_NAME = /^\p{Lu}[\p{L}'’.-]*(?: \p{Lu}[\p{L}'’.-]*){1,3}$/u;
|
|
5
|
+
/** 漢字・カタカナの名前の升: 名前の字の語が、空白一つを挟んで二つか三つ(佐々木 美穂)。 */
|
|
6
|
+
const CJK_NAME = /^[\p{Script=Han}\p{Script=Katakana}ー々]+(?:[ \u3000][\p{Script=Han}\p{Script=Katakana}ー々]+){1,2}$/u;
|
|
7
|
+
const SPACE = /[ \u3000]/u;
|
|
8
|
+
const LOWER = /\p{Ll}/u;
|
|
9
|
+
/** 範囲の中の語の読みをつないだもの。記号と空白の語は読まない。読めない語があれば無い。 */
|
|
10
|
+
export const readingWithin = (tokens, start, end) => {
|
|
11
|
+
const words = tokens.filter((token) => token.span.start >= start && token.span.end <= end && token.pos !== "PUNCT" && token.surface.trim() !== "");
|
|
12
|
+
const readings = words.map((token) => token.reading);
|
|
13
|
+
return words.length > 0 && readings.every((reading) => reading !== undefined && reading !== "") ? readings.join("") : undefined;
|
|
14
|
+
};
|
|
15
|
+
/** 名前の形をした升。升の字の前後の空白と強調の印は名前の外。 */
|
|
16
|
+
export const cellNamesIn = (cells) => cells.flatMap((cell) => {
|
|
17
|
+
const surface = withoutEdgeMarks(cell.text.trim());
|
|
18
|
+
if (!(LATIN_NAME.test(surface) && LOWER.test(surface)) && !CJK_NAME.test(surface))
|
|
19
|
+
return [];
|
|
20
|
+
const offset = cell.start + cell.text.indexOf(surface);
|
|
21
|
+
return [{ surface, offset, words: surface.split(SPACE), reading: readingWithin(cell.tokens ?? [], offset, offset + surface.length) }];
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* 本文の名前の書き方ごとの数。空白一つで並んだ名前の現れ(佐々木 と 美穂)は、一つの名前(佐々木 美穂)としても数える。
|
|
25
|
+
* 日本語の解析器は姓と名のあいだの空白で名前を切る。
|
|
26
|
+
*/
|
|
27
|
+
export const proseNamesOf = (mentions, source) => {
|
|
28
|
+
const sorted = mentions.toSorted((left, right) => left.offset - right.offset);
|
|
29
|
+
const joined = sorted.flatMap((mention, index) => {
|
|
30
|
+
const next = sorted[index + 1];
|
|
31
|
+
const end = mention.offset + mention.surface.length;
|
|
32
|
+
if (next === undefined || next.offset !== end + 1 || !SPACE.test(source.charAt(end)))
|
|
33
|
+
return [];
|
|
34
|
+
const reading = mention.reading === undefined || next.reading === undefined ? undefined : `${mention.reading}${next.reading}`;
|
|
35
|
+
return [{ surface: `${mention.surface}${source.charAt(end)}${next.surface}`, reading }];
|
|
36
|
+
});
|
|
37
|
+
const forms = new Map();
|
|
38
|
+
[...sorted, ...joined].forEach(({ surface, reading }) => {
|
|
39
|
+
const form = forms.get(surface);
|
|
40
|
+
forms.set(surface, form === undefined ? { surface, words: surface.split(SPACE), count: 1, reading } : { ...form, count: form.count + 1 });
|
|
41
|
+
});
|
|
42
|
+
return [...forms.values()];
|
|
43
|
+
};
|
|
44
|
+
const LATIN = /\p{Script=Latin}/u;
|
|
45
|
+
/** 英字の語の中の記号(O'Connor、Anne-Marie)。一字違いは字だけで見る。 */
|
|
46
|
+
const WORD_MARKS = /['’.-]/gu;
|
|
47
|
+
/**
|
|
48
|
+
* 二つの英字の語が一字違いか(名前の見方と同じ isNearWord)。漢字・かなの語は見ない。升は読みが分からず、一字違いの名前
|
|
49
|
+
* (佐藤 太郎 と 佐藤 次郎)は別の人のことが多い。
|
|
50
|
+
*/
|
|
51
|
+
const isNearNameWord = (left, right) => LATIN.test(left) && LATIN.test(right) && isNearWord(left.toLowerCase().replaceAll(WORD_MARKS, ""), right.toLowerCase().replaceAll(WORD_MARKS, ""));
|
|
52
|
+
/**
|
|
53
|
+
* 升の名前が、本文の名前の書き分けか。記号・幅・大小だけの違いか、語の数が同じで一語だけが違い、残りの語が同じとき。違う一語は、
|
|
54
|
+
* 英字なら一字違い、漢字・かなら名前全体の読みが同じ(本文の名前の見方と同じ)。この二つは、本文の形が二度以上、升の形が文書の
|
|
55
|
+
* 中で一度だけのとき(別の人のこともある)。
|
|
56
|
+
*/
|
|
57
|
+
export const cellNameRelation = (name, uses, prose) => {
|
|
58
|
+
if (name.surface === prose.surface || name.words.length !== prose.words.length)
|
|
59
|
+
return undefined;
|
|
60
|
+
if (nameKey(name.surface) === nameKey(prose.surface))
|
|
61
|
+
return "spelling";
|
|
62
|
+
const differ = name.words.flatMap((word, index) => (word === prose.words[index] ? [] : [index]));
|
|
63
|
+
const [at] = differ;
|
|
64
|
+
if (differ.length !== 1 || at === undefined || uses !== 1 || prose.count < 2)
|
|
65
|
+
return undefined;
|
|
66
|
+
if (isNearNameWord(name.words[at] ?? "", prose.words[at] ?? ""))
|
|
67
|
+
return "near";
|
|
68
|
+
return name.reading !== undefined && name.reading === prose.reading ? "reading" : undefined;
|
|
69
|
+
};
|
|
70
|
+
/** 記号・幅・大小だけの違いを、読みの同じものと一字違いより先に取る。 */
|
|
71
|
+
const KIND_ORDER = ["spelling", "reading", "near"];
|
|
72
|
+
/**
|
|
73
|
+
* 表の升の名前のうち、本文の名前の書き分けのもの。記号だけの違いを先に、その中で本文の形のうち一番多いものと比べる。
|
|
74
|
+
* 書き方ごとに最初の升を一つ。
|
|
75
|
+
*/
|
|
76
|
+
export const cellNameVariants = (names, prose) => {
|
|
77
|
+
const uses = new Map(prose.map((form) => [form.surface, form.count]));
|
|
78
|
+
const firsts = new Map();
|
|
79
|
+
names.forEach((name) => {
|
|
80
|
+
uses.set(name.surface, (uses.get(name.surface) ?? 0) + 1);
|
|
81
|
+
if (!firsts.has(name.surface))
|
|
82
|
+
firsts.set(name.surface, name);
|
|
83
|
+
});
|
|
84
|
+
return [...firsts.values()].flatMap((name) => {
|
|
85
|
+
const [usual] = prose
|
|
86
|
+
.flatMap((form) => {
|
|
87
|
+
const kind = cellNameRelation(name, uses.get(name.surface) ?? 0, form);
|
|
88
|
+
return kind === undefined ? [] : [{ form, kind }];
|
|
89
|
+
})
|
|
90
|
+
.toSorted((left, right) => KIND_ORDER.indexOf(left.kind) - KIND_ORDER.indexOf(right.kind) || right.form.count - left.form.count);
|
|
91
|
+
return usual === undefined ? [] : [{ name, usual: usual.form.surface, kind: usual.kind }];
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=table-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-names.js","sourceRoot":"","sources":["../src/table-names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAoB,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAezD,qEAAqE;AACrE,MAAM,UAAU,GAAG,mDAAmD,CAAC;AACvE,mDAAmD;AACnD,MAAM,QAAQ,GAAG,mGAAmG,CAAC;AACrH,MAAM,KAAK,GAAG,YAAY,CAAC;AAC3B,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAwB,EAAE,KAAa,EAAE,GAAW,EAAsB,EAAE;IACxG,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,C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CAAC;IAC5F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chaffjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "Prose validation harness. Finds what is hard to read, and never rewrites it for you.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chaff",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@anthropic-ai/sdk": "^0.125.0",
|
|
90
|
-
"@chaffjs/lang-en": "0.
|
|
91
|
-
"@chaffjs/lang-ja": "0.
|
|
90
|
+
"@chaffjs/lang-en": "0.27.0",
|
|
91
|
+
"@chaffjs/lang-ja": "0.29.0",
|
|
92
92
|
"character-entities": "^2.0.2",
|
|
93
93
|
"mdast-util-from-markdown": "^2.0.3",
|
|
94
94
|
"mdast-util-frontmatter": "^2.0.1",
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
id: connection-time-short
|
|
2
|
+
layer: L3
|
|
3
|
+
status: stable
|
|
4
|
+
how_to_find: connection-time-short
|
|
5
|
+
requires: [dates]
|
|
6
|
+
severity: warning
|
|
7
|
+
|
|
8
|
+
name:
|
|
9
|
+
ja: 移動の時間より短い乗り継ぎ
|
|
10
|
+
en: A connection shorter than the stated travel time
|
|
11
|
+
|
|
12
|
+
why:
|
|
13
|
+
ja: 「福岡 09:50着」のあと「09:55 博多駅で合流(福岡空港から地下鉄で約10分)」のように、文書に書いた移動の時間より次の予定までの間が短いと、どちらかの時刻か移動の時間を書き間違えています。そのまま動くと次の予定に遅れます。移動の時間は、文書に書いたもの(移動の語と同じ文の「約10分」「乗り換えに30分」)だけを使い、実際にかかる時間は推し量りません。移動を書いた予定(「10:00 京都駅から貸切バスで清水寺へ(約30分)」)はその時刻から次の予定まで、予定に添えた移動の時間はすぐ前の着の時刻からその予定までの間と比べます。
|
|
14
|
+
en: 'When a schedule leaves less time than the travel time it states itself, as in "arrives Washington Reagan 9:05 AM" followed by "9:15 AM Meet Ms. Tanaka at Metro Center (25 minutes from the airport by Metro)", one of the times or the travel time is wrong, and whoever follows it will be late. Only travel times the document states are used (a length in the same sentence as a word of travel: "about 40 minutes by train", "allow 45 minutes"); real travel times are never assumed. A line that is itself a move ("09:30 Coach from York station to the Minster (about 15 minutes)") is measured from its time to the next item of the day; a travel time added to an item is measured from the arrival just before it.'
|
|
15
|
+
|
|
16
|
+
message:
|
|
17
|
+
ja: 「{from}」から「{time}」まで{gap}分しかなく、書いてある移動の時間({travel})より短いです
|
|
18
|
+
en: "Only {gap} minutes from {from} to {time}, less than the stated travel time ({travel})"
|
|
19
|
+
|
|
20
|
+
how_to_fix:
|
|
21
|
+
ja: 着の時刻、次の予定の時刻、移動の時間を確かめて、書き間違えたものを直してください。
|
|
22
|
+
en: Check the arrival, the next time and the stated travel time, and correct the wrong one.
|
|
23
|
+
|
|
24
|
+
levels: { strict: error, normal: warning, relaxed: info }
|
|
25
|
+
|
|
26
|
+
use_for: [business, technical, blog, legal, docs, academic, literature, speech]
|
|
27
|
+
off_for:
|
|
28
|
+
literature: "Length, rhythm, repetition and register are the author's choices in literature, and dialogue mixes styles. Only what one work can hold itself to runs: consistent spacing and commas, and numbering without gaps."
|
|
29
|
+
|
|
30
|
+
group: facts
|
|
31
|
+
summary:
|
|
32
|
+
ja: 旅程で、次の予定までの間が文書に書いた移動の時間より短い所
|
|
33
|
+
en: An itinerary that leaves less time for a connection than the travel time it states
|
|
34
|
+
example:
|
|
35
|
+
ja:
|
|
36
|
+
before: |
|
|
37
|
+
- 08:00 JAL 305便(羽田 08:00発、福岡 09:50着)
|
|
38
|
+
- 09:55 博多駅で合流(福岡空港から地下鉄で約10分)
|
|
39
|
+
after: |
|
|
40
|
+
- 08:00 JAL 305便(羽田 08:00発、福岡 09:50着)
|
|
41
|
+
- 10:30 博多駅で合流(福岡空港から地下鉄で約10分)
|
|
42
|
+
en:
|
|
43
|
+
before: |
|
|
44
|
+
- 7:30 AM Flight AA 2140 (departs Boston 7:30 AM, arrives Washington Reagan 9:05 AM)
|
|
45
|
+
- 9:15 AM Meet Ms. Tanaka at Metro Center (25 minutes from the airport by Metro)
|
|
46
|
+
after: |
|
|
47
|
+
- 7:30 AM Flight AA 2140 (departs Boston 7:30 AM, arrives Washington Reagan 9:05 AM)
|
|
48
|
+
- 10:00 AM Meet Ms. Tanaka at Metro Center (25 minutes from the airport by Metro)
|
|
49
|
+
|
|
50
|
+
not_flagged:
|
|
51
|
+
ja: 移動の時間を書いていない所、上限として書いた時間(徒歩10分以内)、すぐ前の時刻が着でない所、日付の違う時刻、翌日の印のある時刻、時刻が戻る所(夜をまたぐ)、時間帯の印の違う時刻は言いません。
|
|
52
|
+
en: 'No stated travel time, a time given as an upper limit ("within 10 minutes"), a time whose previous time is not an arrival, times on different dates, a time marked as the next day, a time that goes back (overnight), and times with different time zones are not reported.'
|
|
@@ -10,8 +10,8 @@ name:
|
|
|
10
10
|
en: A date outside the stated period
|
|
11
11
|
|
|
12
12
|
why:
|
|
13
|
-
ja: 「旅行期間:10月12日〜10月15日」と書いた旅程の中に10月17日の予定があると、期間と日程のどちらが正しいのかを読み手が問い合わせることになります。日付を書き写し間違えたときや、日程を動かして期間を直し忘れたときに起きます。期間は「旅行期間」「会期」のような期間の語で始まる一行から読み、その後ろの同じ節の箇条書き、表の行、見出しの日付と、地の文の年の無い日付を比べます。前泊や事後の予定、申込締切や予約の日、過去の回のように、期間の外に置く語がその行や文、節の見出しにある日付は比べません。年の無い期間(12月28日〜1月4
|
|
14
|
-
en: 'When an itinerary says "Trip dates: Oct 12–15" and then lists something on October 17, the reader has to ask whether the period or the schedule is right. It happens when a date is copied wrong, or when the schedule moves and the period is not updated. The period is read from one line that starts with a period word such as "Trip dates" or "Conference", and the dates after it in the same section are compared, in list items, table rows and headings, and in running text when the date has no year. A date whose item, sentence or section heading marks it as outside the period on purpose (a post-trip meeting, a booking deadline, a past edition) is not compared. A period without a year ("Dec 28 – Jan 4") is read as running into the new year.'
|
|
13
|
+
ja: 「旅行期間:10月12日〜10月15日」と書いた旅程の中に10月17日の予定があると、期間と日程のどちらが正しいのかを読み手が問い合わせることになります。日付を書き写し間違えたときや、日程を動かして期間を直し忘れたときに起きます。期間は「旅行期間」「会期」のような期間の語で始まる一行から読み、その後ろの同じ節の箇条書き、表の行、見出しの日付と、地の文の年の無い日付を比べます。前泊や事後の予定、申込締切や予約の日、過去の回のように、期間の外に置く語がその行や文、節の見出しにある日付は比べません。年の無い期間(12月28日〜1月4日)は年をまたぐ期間として読みます。「開講期間」のように文書の仕事がその中で済む期間を、文書の頭か概要の節に書いたときは、後ろのどの節でも「提出」「締切」のある項目や文の年のある日付が期間の終わりより後なら指します(課題の提出期限が学期の後)。
|
|
14
|
+
en: 'When an itinerary says "Trip dates: Oct 12–15" and then lists something on October 17, the reader has to ask whether the period or the schedule is right. It happens when a date is copied wrong, or when the schedule moves and the period is not updated. The period is read from one line that starts with a period word such as "Trip dates" or "Conference", and the dates after it in the same section are compared, in list items, table rows and headings, and in running text when the date has no year. A date whose item, sentence or section heading marks it as outside the period on purpose (a post-trip meeting, a booking deadline, a past edition) is not compared. A period without a year ("Dec 28 – Jan 4") is read as running into the new year. When the period the document''s work is done in ("Term") is stated at the top or in the overview section, a date with a year after its end in an item or sentence of any later section that says "submit", "due" or "deadline" is reported (an assignment due after the term).'
|
|
15
15
|
|
|
16
16
|
message:
|
|
17
17
|
ja: 「{date}」が、書いた期間「{period}」の外です
|
|
@@ -60,5 +60,5 @@ example:
|
|
|
60
60
|
- May 5: closing session
|
|
61
61
|
|
|
62
62
|
not_flagged:
|
|
63
|
-
ja:
|
|
64
|
-
en: 'A document with no stated period, a date marked as outside on purpose ("post-trip", "follow-up", "book by", "deadline", "previous"), and the new-year dates of a period without a year that runs past December 31 are not compared.'
|
|
63
|
+
ja: 期間を書いていない文書、期間の外に置く語(前泊、事後、申込締切、予約、前回)のある日付、年の無い期間が年をまたぐときの年明けの日付は比べません。旅行期間や会期の後の締め切り(精算書の提出)、支払の期限は指しません。
|
|
64
|
+
en: 'A document with no stated period, a date marked as outside on purpose ("post-trip", "follow-up", "book by", "deadline", "previous"), and the new-year dates of a period without a year that runs past December 31 are not compared. A deadline after a trip or a conference (an expense report) and a payment deadline are not reported.'
|
|
@@ -10,8 +10,8 @@ name:
|
|
|
10
10
|
en: A start plus a length of time that does not reach the stated end
|
|
11
11
|
|
|
12
12
|
why:
|
|
13
|
-
ja: 「4月1日から3か月間(7月31日まで)」のように、始まりと期間と終わりを一緒に書くと、読み手は三つのうちどれが正しいのか分かりません。期間か日付の片方だけを直したときに起きます。一つの文に日付が二つと期間が一つあるとき、始まりに期間を足した日を終わりと比べます。終わりの日を含めて数える書き方(4月1日から3か月間は6月30日まで)、含めない書き方(7月1日まで)、初日を数えずに期間が過ぎた日(「4月1日から2週間が経過した日(4月16日)」)のどれとも合わないときだけ指します。泊数は二つの日付の差の日数と比べます(10月12日から10月14日までは2泊)。一つの文に日付が二つと泊数が一つある所と、チェックイン・チェックアウト・泊数の列がそろった表の行を見ます。「2泊3
|
|
14
|
-
en: 'When a start, a length and an end are written together ("for 3 months from April 1, 2026, until July 31, 2026"), the reader cannot tell which of the three is right. It happens when the length or one date is changed and not the other. In a sentence with two dates and one length of time, the start plus the length is compared with the end. Three ways of counting are accepted: with the last day included (April 1 plus 3 months is June 30), without it (July 1), and the day after the period has passed when the first day is not counted (July 2); it is pointed out only when the end matches none. A number of nights is compared with the days between two dates (Oct 12 to Oct 14 is 2 nights), in a sentence with two dates and one number of nights, and in each row of a table with check-in, check-out and nights columns. Where nights and days are written together ("2 days, 1 night"), the days must be one more than the nights.'
|
|
13
|
+
ja: 「4月1日から3か月間(7月31日まで)」のように、始まりと期間と終わりを一緒に書くと、読み手は三つのうちどれが正しいのか分かりません。期間か日付の片方だけを直したときに起きます。一つの文に日付が二つと期間が一つあるとき、始まりに期間を足した日を終わりと比べます。終わりの日を含めて数える書き方(4月1日から3か月間は6月30日まで)、含めない書き方(7月1日まで)、初日を数えずに期間が過ぎた日(「4月1日から2週間が経過した日(4月16日)」)のどれとも合わないときだけ指します。泊数は二つの日付の差の日数と比べます(10月12日から10月14日までは2泊)。一つの文に日付が二つと泊数が一つある所と、チェックイン・チェックアウト・泊数の列がそろった表の行を見ます。「2泊3日」のように泊数と日数を並べたら、日数は泊数より一つ多いはずです。勤務時間(9:00〜17:30、休憩1時間、実働8時間)は、終わりから始まりと休憩を引いた時間を実働と比べます。
|
|
14
|
+
en: 'When a start, a length and an end are written together ("for 3 months from April 1, 2026, until July 31, 2026"), the reader cannot tell which of the three is right. It happens when the length or one date is changed and not the other. In a sentence with two dates and one length of time, the start plus the length is compared with the end. Three ways of counting are accepted: with the last day included (April 1 plus 3 months is June 30), without it (July 1), and the day after the period has passed when the first day is not counted (July 2); it is pointed out only when the end matches none. A number of nights is compared with the days between two dates (Oct 12 to Oct 14 is 2 nights), in a sentence with two dates and one number of nights, and in each row of a table with check-in, check-out and nights columns. Where nights and days are written together ("2 days, 1 night"), the days must be one more than the nights. Working hours ("9:00–17:30 with a 1-hour break, 8 hours a day") are checked by taking the start and the break from the end and comparing what is left with the stated hours.'
|
|
15
15
|
|
|
16
16
|
message:
|
|
17
17
|
ja: "{start}から{duration}なら、終わりは{expected}ごろのはずですが、{end}と書かれています"
|
|
@@ -24,6 +24,9 @@ messages:
|
|
|
24
24
|
nights-days:
|
|
25
25
|
ja: "{nights}なら日数は{expected}日のはずですが、{days}と書かれています"
|
|
26
26
|
en: "{nights} makes {expected} days, but {days} is written"
|
|
27
|
+
working-hours:
|
|
28
|
+
ja: "{start}から{end}まで、休憩{break}を除くと{expected}時間のはずですが、{total}と書かれています"
|
|
29
|
+
en: "{start} to {end} less a break of {break} makes {expected} hours, but {total} is written"
|
|
27
30
|
|
|
28
31
|
how_to_fix:
|
|
29
32
|
ja: 期間と終わりの日付のどちらが正しいかを確かめて、もう一方を直してください。
|
|
@@ -50,8 +53,8 @@ example:
|
|
|
50
53
|
The trial runs for 3 months from April 1, 2026 (until June 30, 2026).
|
|
51
54
|
|
|
52
55
|
not_flagged:
|
|
53
|
-
ja: 三通りの数え方(終わりを含める、含めない、初日を数えずに過ぎた日)のどれとも合わないときだけ指します。「約3か月」「3か月程度」のような目安の期間、日付が三つ以上か期間が二つ以上ある文、年を書いた日付と書かない日付の組は見ません。「最大3
|
|
54
|
-
en: Only an end that matches none of the three ways of counting is pointed out. A rough length ("about 3 months"), a sentence with three or more dates or two or more lengths, and a pair of one date with a year and one without are left alone. So are a rough number of nights ("up to 3 nights") and nights written without dates.
|
|
56
|
+
ja: 三通りの数え方(終わりを含める、含めない、初日を数えずに過ぎた日)のどれとも合わないときだけ指します。「約3か月」「3か月程度」のような目安の期間、日付が三つ以上か期間が二つ以上ある文、年を書いた日付と書かない日付の組は見ません。「最大3泊」のような目安の泊数と、日付の無い泊数も見ません。勤務時間は、実働の書いていない所、長さの無い休憩(休憩あり)、一行に時間の範囲が二つ以上ある所(シフト表は行ごとに実働を書いた行だけ)、「翌」などの印の無い日をまたぐ範囲を見ません。
|
|
57
|
+
en: Only an end that matches none of the three ways of counting is pointed out. A rough length ("about 3 months"), a sentence with three or more dates or two or more lengths, and a pair of one date with a year and one without are left alone. So are a rough number of nights ("up to 3 nights") and nights written without dates. Working hours are left alone without a stated total, with a break of no length ("breaks provided"), with two or more ranges of time on a line (a shift table only on rows that state their own hours), and across midnight without a next-day mark.
|
|
55
58
|
rewrite:
|
|
56
59
|
depth: light
|
|
57
60
|
ja:
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
id: duration-product-mismatch
|
|
2
|
+
layer: L3
|
|
3
|
+
status: stable
|
|
4
|
+
how_to_find: duration-product-mismatch
|
|
5
|
+
# Counts use session-count-unit (and count-number for words), lengths the hour and minute units of unit-time (and
|
|
6
|
+
# length-half), the total session-total; approximate-marker marks a rough total.
|
|
7
|
+
severity: warning
|
|
8
|
+
|
|
9
|
+
name:
|
|
10
|
+
ja: 回数と1回の長さを掛けた時間が、書いた合計と合わない
|
|
11
|
+
en: A number of sessions times their length that does not make the stated total
|
|
12
|
+
|
|
13
|
+
why:
|
|
14
|
+
ja: 「1回90分、全15回、合計24時間」のように、回数と1回の長さと合計を一緒に書くと、読み手は三つのうちどれが正しいのか分かりません(90分×15回は22.5時間)。回数か長さを変えて、合計を直し忘れたときに起きます。一行か、一つの箇条書きの中に、回数・1回の長さ・合計がちょうど一つずつあるときに、回数×長さを合計と比べます。
|
|
15
|
+
en: 'When a count of sessions, the length of one and the total are written together ("90 minutes per session, 15 sessions, 24 hours in total"), the reader cannot tell which of the three is right (15 sessions of 90 minutes make 22.5 hours). It happens when the count or the length is changed and the total is not. In one line, or one list, holding exactly one count, one length and one total, the count times the length is compared with the total.'
|
|
16
|
+
|
|
17
|
+
message:
|
|
18
|
+
ja: "{length}×{count}なら合計は{expected}時間のはずですが、{total}と書かれています"
|
|
19
|
+
en: "{count} of {length} make {expected} hours, but the total is given as {total}"
|
|
20
|
+
|
|
21
|
+
how_to_fix:
|
|
22
|
+
ja: 回数・1回の長さ・合計のどれが正しいかを確かめて、残りを直してください。
|
|
23
|
+
en: Check which of the count, the length and the total is right and correct the rest.
|
|
24
|
+
|
|
25
|
+
levels: { normal: warning, relaxed: info }
|
|
26
|
+
|
|
27
|
+
use_for: [business, technical, blog, legal, docs, academic, literature, speech]
|
|
28
|
+
|
|
29
|
+
group: facts
|
|
30
|
+
summary:
|
|
31
|
+
ja: 「90分×15回(計24時間)」のように、回数と1回の長さを掛けても書いた合計にならない所
|
|
32
|
+
en: A count of sessions times the length of one that does not make the total written beside them
|
|
33
|
+
example:
|
|
34
|
+
ja:
|
|
35
|
+
before: |
|
|
36
|
+
授業時間:1回90分、全15回、合計24時間
|
|
37
|
+
after: |
|
|
38
|
+
授業時間:1回90分、全15回、合計22.5時間
|
|
39
|
+
en:
|
|
40
|
+
before: |
|
|
41
|
+
Class hours: 90 minutes per session, 15 sessions, 24 hours in total
|
|
42
|
+
after: |
|
|
43
|
+
Class hours: 90 minutes per session, 15 sessions, 22.5 hours in total
|
|
44
|
+
|
|
45
|
+
not_flagged:
|
|
46
|
+
ja: 回数・1回の長さ・合計のどれかが欠けている所、どれかが二つ以上ある所、1回の長さが目安(約90分)の所は見ません。合計が目安(約23時間)なら、書いた単位より小さい差は合っているとみなします。
|
|
47
|
+
en: A line missing the count, the length or the total, one with two of any of them, and a rough length ("about 90 minutes") are left alone. A rough total ("about 23 hours") may differ by less than the unit it is written in.
|
|
48
|
+
rewrite:
|
|
49
|
+
depth: light
|
|
50
|
+
ja:
|
|
51
|
+
direction: 回数・1回の長さ・合計のうち、どれが正しいかを書き手に確かめ、残りを合わせてください。
|
|
52
|
+
pairs:
|
|
53
|
+
- before: 90分×15回(計24時間)
|
|
54
|
+
after: 90分×15回(計22.5時間)
|
|
55
|
+
- before: 1回90分、全15回、合計24時間
|
|
56
|
+
after: 1回90分、全16回、合計24時間
|
|
57
|
+
keep:
|
|
58
|
+
- 確かめた回数と1回の長さ
|
|
59
|
+
avoid:
|
|
60
|
+
- どれが正しいかを推測で決める
|
|
61
|
+
- 合計を「約」でぼかして合わせる
|
|
62
|
+
en:
|
|
63
|
+
direction: Ask the writer which of the count, the length and the total is right, and make the rest agree.
|
|
64
|
+
pairs:
|
|
65
|
+
- before: 15 sessions of 90 minutes (24 hours in total)
|
|
66
|
+
after: 15 sessions of 90 minutes (22.5 hours in total)
|
|
67
|
+
- before: 90 minutes per session, 15 sessions, 24 hours in total
|
|
68
|
+
after: 90 minutes per session, 16 sessions, 24 hours in total
|
|
69
|
+
keep:
|
|
70
|
+
- the confirmed count and length
|
|
71
|
+
avoid:
|
|
72
|
+
- guessing which value is right
|
|
73
|
+
- blurring the total with "about" to make it fit
|
package/rules/name-variant.yaml
CHANGED
|
@@ -30,6 +30,9 @@ messages:
|
|
|
30
30
|
near:
|
|
31
31
|
ja: 「{name}」は、ほかの所で何度も書いた「{usual}」と一字違いです
|
|
32
32
|
en: '"{name}" is one letter away from "{usual}", which the document uses more than once'
|
|
33
|
+
surname:
|
|
34
|
+
ja: 「{name}」は、ほかの所で何度も書いた「{usual}」と名が同じで、姓が数字だけ違います
|
|
35
|
+
en: '"{name}" has the given name of "{usual}", which the document uses more than once, and a surname a few letters away'
|
|
33
36
|
place-word:
|
|
34
37
|
ja: 「{name}」は、ほかの所では場所の語を別の形にして「{usual}」と書いています
|
|
35
38
|
en: '"{name}" is written "{usual}", with the place word in another form, elsewhere in the document'
|
|
@@ -39,6 +42,9 @@ messages:
|
|
|
39
42
|
company-position:
|
|
40
43
|
ja: 「{name}」は、ほかの所では会社の種類を名前の反対側に置いて「{usual}」と書いています
|
|
41
44
|
en: '"{name}" is written "{usual}", with the company form on the other side, elsewhere in the document'
|
|
45
|
+
order:
|
|
46
|
+
ja: 「{name}」は、ほかの所では語の順を入れ替えた「{usual}」と書いています
|
|
47
|
+
en: '"{name}" is written "{usual}", with the words in another order, elsewhere in the document'
|
|
42
48
|
company-near:
|
|
43
49
|
ja: 「{name}」は、ほかの所で書いた会社名「{usual}」と一字違いです
|
|
44
50
|
en: '"{name}" is one letter away from the company name "{usual}" written elsewhere in the document'
|
|
@@ -76,8 +82,8 @@ example:
|
|
|
76
82
|
The code lives on GitHub. Reviews happen on GitHub, and releases are tagged on GitHub.
|
|
77
83
|
|
|
78
84
|
not_flagged:
|
|
79
|
-
ja: 品詞解析が固有名詞と読んだ語だけを見ます。大文字だけの名前(ACME INC、NASA)は見ません。一字違いの英字の名前は、6 字以上で、多いほうが二度以上、少ないほうが一度だけのときに限ります(Iran と Iraq は別の名前)。人の名前どうしは、字体の違う同じ字(斎藤 と 斉藤、渡辺 と 渡邊)か、読みが同じで一字だけ違い、多いほうが二度以上、少ないほうが一度だけのとき(松本 と 松元)に限ります(伊藤 と 伊東 は別の人のことがある)。人の名前とは、品詞解析が人名と読んだ語か、「様」「さん」「氏」の付いた名前です(解析器が名前と読めない字体の字を含む名前は、敬称の前の 2〜4 字の漢字を名前と読みます)。敬称の無い名前も、前後に漢字が続かない 2〜4 字の漢字で、片方の書き方に「担当の」「私、」などの前置きか敬称が付き、もう片方が「です」「が」「までご連絡」などの前にあれば比べます(担当の斎藤です と 斉藤までご連絡ください)。地名にも同じ組がある(鹿島 と 鹿嶋)ので、どちらにも前置きも敬称も無いときは比べません。会社の名前は、語彙表の会社の種類の語(株式会社、(株)、有限会社)の隣にあるものを、品詞と関係なく比べます。名前が同じで種類の語が違うもの(株式会社 と 有限会社)、種類の語を名前の反対側に置いたもの(株式会社アオバ と アオバ株式会社)、記号・幅だけが違うものを指します。同じ種類の語の略した形(株式会社 と (株))、種類の語を省いた呼び名(アオバシステム、以下「アオバ」)は指しません。名前の一字違いは、7 字以上の名前で、違う字が漢字でないときに限ります(日本電気 と 日本電機 は別の会社のことがある)。漢字だけの名前は、品詞解析が固有名詞と読んだときだけ会社の名前と見ます(清算株式会社、当該株式会社)。場所の名前は、語彙表の場所の語(口、駅、センター、ホール)で終わる名前を、品詞と関係なく比べます。記号・幅だけが違うもの(コンベンションセンター と コンベンション・センター)を指し、名前の読みが同じかかなで書いた読みのもの(筑紫口 と ちくし口)と、固有名詞の字の一字違い(八重洲中央口 と 八重州中央口)は、多いほうが二度以上、少ないほうが一度だけのときに限ります。方角や数字の違い(北口 と 南口、第1会議室 と 第2
|
|
80
|
-
en: Only words the tagger reads as proper nouns are checked. Names in capitals only (ACME INC, NASA) are left out. Names one letter apart are reported only when six letters or longer, with the usual form used at least twice and the other once (Iran and Iraq are different names). Two Japanese person names are compared only when written with another form of the same character (斎藤 and 斉藤), or read the same with one character different, the usual form used at least twice and the other once (松本 and 松元); 伊藤 and 伊東 can be two people. A person's name is one the tagger reads as such, or one followed by 様, さん or 氏 (when a name holds a character form the tagger cannot read, the two to four kanji before the honorific are taken as the name). A name without an honorific is compared too when it is two to four kanji standing alone, one form has a lead such as 担当の or 私、 or an honorific, and the other stands before a word such as です, が or までご連絡 (担当の斎藤です and 斉藤までご連絡ください). Places have such pairs as well (鹿島 and 鹿嶋), so two forms with neither a lead nor an honorific are not compared. A company name is one next to a company form from the lexicon (Inc., Ltd., Co., Ltd., LLC), whatever the tagger reads it as. The same name with forms of two kinds (Inc. and Ltd.), and the same name written with other punctuation or width, are reported. The short and long spelling of one form (Inc and Incorporated) and a name written without its form (Aoba Systems, the "Company") are not. Two names one letter apart are reported only when seven letters or longer, with the same form, and the letter is not a kanji. A place name is one ending in a place word from the lexicon (Street, St., Avenue, Station, Center), whatever the tagger reads it as. The same place written with other punctuation (King's Cross and Kings Cross) or with the place word short and long (11th Street and 11th St.) is reported; a place whose name is one letter away (Union Station and Unoin Station) only when the usual form is used at least twice and the other once. Other numbers and other names (1st Street and 2nd Street, North Hall and South Hall) are different places.
|
|
85
|
+
ja: 品詞解析が固有名詞と読んだ語だけを見ます。大文字だけの名前(ACME INC、NASA)は見ません。一字違いの英字の名前は、6 字以上で、多いほうが二度以上、少ないほうが一度だけのときに限ります(Iran と Iraq は別の名前)。人の名前どうしは、字体の違う同じ字(斎藤 と 斉藤、渡辺 と 渡邊)か、読みが同じで一字だけ違い、多いほうが二度以上、少ないほうが一度だけのとき(松本 と 松元)に限ります(伊藤 と 伊東 は別の人のことがある)。人の名前とは、品詞解析が人名と読んだ語か、「様」「さん」「氏」の付いた名前です(解析器が名前と読めない字体の字を含む名前は、敬称の前の 2〜4 字の漢字を名前と読みます)。敬称の無い名前も、前後に漢字が続かない 2〜4 字の漢字で、片方の書き方に「担当の」「私、」などの前置きか敬称が付き、もう片方が「です」「が」「までご連絡」などの前にあれば比べます(担当の斎藤です と 斉藤までご連絡ください)。地名にも同じ組がある(鹿島 と 鹿嶋)ので、どちらにも前置きも敬称も無いときは比べません。会社の名前は、語彙表の会社の種類の語(株式会社、(株)、有限会社)の隣にあるものを、品詞と関係なく比べます。名前が同じで種類の語が違うもの(株式会社 と 有限会社)、種類の語を名前の反対側に置いたもの(株式会社アオバ と アオバ株式会社)、記号・幅だけが違うものを指します。同じ種類の語の略した形(株式会社 と (株))、種類の語を省いた呼び名(アオバシステム、以下「アオバ」)は指しません。名前の一字違いは、7 字以上の名前で、違う字が漢字でないときに限ります(日本電気 と 日本電機 は別の会社のことがある)。漢字だけの名前は、品詞解析が固有名詞と読んだときだけ会社の名前と見ます(清算株式会社、当該株式会社)。場所の名前は、語彙表の場所の語(口、駅、センター、ホール)で終わる名前を、品詞と関係なく比べます。記号・幅だけが違うもの(コンベンションセンター と コンベンション・センター)を指し、名前の読みが同じかかなで書いた読みのもの(筑紫口 と ちくし口)と、固有名詞の字の一字違い(八重洲中央口 と 八重州中央口)は、多いほうが二度以上、少ないほうが一度だけのときに限ります。方角や数字の違い(北口 と 南口、第1会議室 と 第2会議室)は別の所なので指しません。表の升は升ごとに品詞解析し、名前の形をした升(空白を挟んだ二つか三つの漢字・カタカナの語)を本文の名前と比べます。記号・幅だけの違い(佐々木 美穂 と 佐々木 美穂)と、本文と同じく読みが同じで一語だけ違うもの(佐々木 美穂 と 佐々木 美保)を指し、後者は本文の形が二度以上、升の形が一度だけのときに限ります。読みの違う一字違い(佐藤 太郎 と 佐藤 次郎)は別の人のことが多いので指しません(英字の名前は一字違いも指します)。場所の名前は表の升の中のものも比べます。英字の人の名前は、名が同じで、7 字以上の姓の頭 4 字以上がそろい、あいだの 2 字(長いほうは 3 字)までだけ違うもの(Rachel Whitford と Rachel Whitfield)も、多いほうが二度以上、少ないほうが一度だけのときに指します。語の順を入れ替えた名前(統計学基礎 と 基礎統計学)は、同じ語(形態素)を違う順に並べ、どちらも他方を含まず、どちらかが括弧の中か「前提科目:」のような欄の後ろか表の升まるごとに書いた名前のときだけ指します(統計学基礎 と 統計学応用 は別の名前)。
|
|
86
|
+
en: Only words the tagger reads as proper nouns are checked. Names in capitals only (ACME INC, NASA) are left out. Names one letter apart are reported only when six letters or longer, with the usual form used at least twice and the other once (Iran and Iraq are different names). Two Japanese person names are compared only when written with another form of the same character (斎藤 and 斉藤), or read the same with one character different, the usual form used at least twice and the other once (松本 and 松元); 伊藤 and 伊東 can be two people. A person's name is one the tagger reads as such, or one followed by 様, さん or 氏 (when a name holds a character form the tagger cannot read, the two to four kanji before the honorific are taken as the name). A name without an honorific is compared too when it is two to four kanji standing alone, one form has a lead such as 担当の or 私、 or an honorific, and the other stands before a word such as です, が or までご連絡 (担当の斎藤です and 斉藤までご連絡ください). Places have such pairs as well (鹿島 and 鹿嶋), so two forms with neither a lead nor an honorific are not compared. A company name is one next to a company form from the lexicon (Inc., Ltd., Co., Ltd., LLC), whatever the tagger reads it as. The same name with forms of two kinds (Inc. and Ltd.), and the same name written with other punctuation or width, are reported. The short and long spelling of one form (Inc and Incorporated) and a name written without its form (Aoba Systems, the "Company") are not. Two names one letter apart are reported only when seven letters or longer, with the same form, and the letter is not a kanji. A place name is one ending in a place word from the lexicon (Street, St., Avenue, Station, Center), whatever the tagger reads it as. The same place written with other punctuation (King's Cross and Kings Cross) or with the place word short and long (11th Street and 11th St.) is reported; a place whose name is one letter away (Union Station and Unoin Station) only when the usual form is used at least twice and the other once. Other numbers and other names (1st Street and 2nd Street, North Hall and South Hall) are different places. Table cells are tagged cell by cell, and a cell holding only a name (two to four capitalised words, or two or three kanji or katakana words with a space) is compared with the names read in the prose. Reported are the same name with other punctuation or case, or one word different with the other words the same, either a letter away (Sofia Mendes in the text, Sofia Mendez in the table) or, for a Japanese name, read the same as the prose name (佐々木 美穂 and 佐々木 美保); these only when the prose form is used at least twice and the cell form once. Place names inside table cells are compared too. A word next to a name that the tagger did not read as a name (to Rachel Whitford, with Rachel read as a verb) is read with it when the two together are read as a name elsewhere. Two names with the same given name and a surname of seven letters or more, whose first four letters match and which differ in at most two letters between the shared start and end (three in the longer one), are reported when the usual form is used at least twice and the other once (Rachel Whitford and Rachel Whitfield). A different given name (Daniel Whitfield) or a surname alone is not compared this way. A name with its words in another order (Foundations of Statistics and Statistical Foundations) is reported only when both hold the same words (by stem) and neither contains the other, and one of them is written as a name, in quotation marks, after a label such as "Prerequisite" and a colon, or as a whole table cell. Two Title Case runs alone are not compared (Florida Supreme Court and Supreme Court of Florida), nor are two names joined by "and".
|
|
81
87
|
rewrite:
|
|
82
88
|
depth: light
|
|
83
89
|
ja:
|