slopless 0.2.27 → 0.2.29
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/adapters/textlint/units.js +7 -3
- package/dist/presets/everything.js +2 -0
- package/dist/registries/words.js +4 -0
- package/dist/reporting/reports.js +3 -0
- package/dist/rules/private/textlint-rule-builders.js +4 -1
- package/dist/rules/semantic-thinness/patterns/something-shifted.json +125 -7
- package/dist/rules/words/actually-overuse.js +8 -26
- package/dist/rules/words/data/quietly-context.json +692 -0
- package/dist/rules/words/private/quietly-clause.js +60 -0
- package/dist/rules/words/private/quietly-context.js +163 -0
- package/dist/rules/words/private/quietly-evidence.js +68 -0
- package/dist/rules/words/private/token-density-rule.js +31 -0
- package/dist/rules/words/quietly-filler.js +21 -0
- package/dist/rules/words/quietly-overuse.js +22 -0
- package/dist/shared/text/document.js +40 -5
- package/dist/shared/text/sections.js +35 -24
- package/dist/shared/text/traverse.js +57 -3
- package/package.json +4 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeForMatch } from "../../shared/text/normalize.js";
|
|
2
2
|
import { allParagraphSentences, allParagraphs, sectionFirstSentences, sectionLastSentences } from "../../shared/text/sections.js";
|
|
3
|
-
import { documentText } from "../../shared/text/document.js";
|
|
3
|
+
import { documentSourceText, documentText } from "../../shared/text/document.js";
|
|
4
4
|
import { sourceText } from "../../shared/text/traverse.js";
|
|
5
5
|
function isParentNode(node) {
|
|
6
6
|
return "children" in node;
|
|
@@ -44,14 +44,18 @@ function sentenceUnit(id, item) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
export function documentUnit(document) {
|
|
47
|
-
const
|
|
47
|
+
const source = documentSourceText(document);
|
|
48
|
+
const { text } = source;
|
|
48
49
|
return {
|
|
49
50
|
id: "document:0",
|
|
50
51
|
kind: "document",
|
|
51
52
|
node: document,
|
|
52
53
|
normalizedText: normalizeForMatch(text),
|
|
53
54
|
range: { end: text.length, start: 0 },
|
|
54
|
-
sourceRangeFor: (range) =>
|
|
55
|
+
sourceRangeFor: (range) => ({
|
|
56
|
+
end: source.originalEndFor(range.end),
|
|
57
|
+
start: source.originalStartFor(range.start)
|
|
58
|
+
}),
|
|
55
59
|
text
|
|
56
60
|
};
|
|
57
61
|
}
|
|
@@ -42,6 +42,8 @@ export const everything = {
|
|
|
42
42
|
"perception-verb-density": true,
|
|
43
43
|
"prohibited-phrases": true,
|
|
44
44
|
"prohibited-words": true,
|
|
45
|
+
"quietly-filler": true,
|
|
46
|
+
"quietly-overuse": true,
|
|
45
47
|
"recommended-terms": true,
|
|
46
48
|
redundancy: true,
|
|
47
49
|
"repeated-predicate-end": true,
|
package/dist/registries/words.js
CHANGED
|
@@ -3,6 +3,8 @@ import hedgeStacking from "../rules/words/hedge-stacking.js";
|
|
|
3
3
|
import llmVocabularyDensity from "../rules/words/llm-vocabulary-density.js";
|
|
4
4
|
import llmVocabulary from "../rules/words/llm-vocabulary.js";
|
|
5
5
|
import prohibitedWords from "../rules/words/prohibited-words.js";
|
|
6
|
+
import quietlyFiller from "../rules/words/quietly-filler.js";
|
|
7
|
+
import quietlyOveruse from "../rules/words/quietly-overuse.js";
|
|
6
8
|
import simplicity from "../rules/words/simplicity.js";
|
|
7
9
|
export const wordRules = {
|
|
8
10
|
"actually-overuse": actuallyOveruse,
|
|
@@ -10,6 +12,8 @@ export const wordRules = {
|
|
|
10
12
|
"llm-vocabulary-density": llmVocabularyDensity,
|
|
11
13
|
"llm-vocabulary": llmVocabulary,
|
|
12
14
|
"prohibited-words": prohibitedWords,
|
|
15
|
+
"quietly-filler": quietlyFiller,
|
|
16
|
+
"quietly-overuse": quietlyOveruse,
|
|
13
17
|
simplicity
|
|
14
18
|
};
|
|
15
19
|
//# sourceMappingURL=words.js.map
|
|
@@ -133,6 +133,9 @@ export function reportsForPolicy(units, detections, policy, formatMessage) {
|
|
|
133
133
|
message: "",
|
|
134
134
|
range: unit?.sourceRangeFor(detection.range) ?? detection.range,
|
|
135
135
|
ruleId: detection.ruleId,
|
|
136
|
+
...(policy.severity === undefined
|
|
137
|
+
? {}
|
|
138
|
+
: { severity: policy.severity }),
|
|
136
139
|
unitId: detection.unitId
|
|
137
140
|
};
|
|
138
141
|
});
|
|
@@ -18,7 +18,10 @@ export function oneToOneRule(input) {
|
|
|
18
18
|
return defineTextlintRule({
|
|
19
19
|
detector: detector(input),
|
|
20
20
|
formatMessage: input.formatMessage,
|
|
21
|
-
reportPolicy: {
|
|
21
|
+
reportPolicy: {
|
|
22
|
+
kind: "one-to-one",
|
|
23
|
+
...(input.severity === undefined ? {} : { severity: input.severity })
|
|
24
|
+
},
|
|
22
25
|
units: (document) => {
|
|
23
26
|
switch (input.unitKind) {
|
|
24
27
|
case "document":
|
|
@@ -2,14 +2,36 @@
|
|
|
2
2
|
"id": "something-shifted",
|
|
3
3
|
"class": "vague-change",
|
|
4
4
|
"purpose": "Catch vague change declarations that say something shifted, changed, moved, or crossed a line without naming the concrete change.",
|
|
5
|
-
"matchMode": "
|
|
5
|
+
"matchMode": "full",
|
|
6
6
|
"maxTokens": 80,
|
|
7
7
|
"templates": [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
{
|
|
9
|
+
"text": "{genericSubject} {changeVerb}.",
|
|
10
|
+
"matchMode": "contains"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"text": "{genericSubject} had {changeVerb}.",
|
|
14
|
+
"matchMode": "contains"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"text": "{genericSubject} in {abstractContainer} had {changeVerb}.",
|
|
18
|
+
"matchMode": "contains"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"text": "{concreteSubject} did not {changeVerb}, but {genericSubject} in it did.",
|
|
22
|
+
"matchMode": "contains"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"text": "{genericSubject} {changeVerb} when {genericSubject} {abstractAction}.",
|
|
26
|
+
"matchMode": "contains"
|
|
27
|
+
},
|
|
28
|
+
"{diffuseSubject} {weakMannerAdverb} {finiteChange}.",
|
|
29
|
+
"{diffuseSubject} {progressiveAuxiliary} {weakMannerAdverb} {progressiveChange}.",
|
|
30
|
+
"{diffuseSubject} {perfectAuxiliary} {weakMannerAdverb} {pastChange}.",
|
|
31
|
+
"{diffuseSubject} {finiteChange} {weakMannerAdverb}.",
|
|
32
|
+
"{deicticSubject} {weakMannerAdverb} {emptyChangeObject}.",
|
|
33
|
+
"{shiftDeterminer} {shiftModifier} shift {emptyShiftPredicate}.",
|
|
34
|
+
"{deicticSubject} {signalVerb} {shiftDeterminer} {shiftModifier} shift."
|
|
13
35
|
],
|
|
14
36
|
"slots": {
|
|
15
37
|
"genericSubject": [
|
|
@@ -45,7 +67,103 @@
|
|
|
45
67
|
"chose differently",
|
|
46
68
|
"named the truth",
|
|
47
69
|
"let go"
|
|
48
|
-
]
|
|
70
|
+
],
|
|
71
|
+
"diffuseSubject": [
|
|
72
|
+
"the market",
|
|
73
|
+
"the industry",
|
|
74
|
+
"search",
|
|
75
|
+
"the web",
|
|
76
|
+
"the landscape",
|
|
77
|
+
"the platform",
|
|
78
|
+
"the system",
|
|
79
|
+
"the process",
|
|
80
|
+
"the conversation",
|
|
81
|
+
"the work",
|
|
82
|
+
"the strategy",
|
|
83
|
+
"the model",
|
|
84
|
+
"the product",
|
|
85
|
+
"the category",
|
|
86
|
+
"the space"
|
|
87
|
+
],
|
|
88
|
+
"progressiveAuxiliary": ["is", "was", "has been", "had been"],
|
|
89
|
+
"perfectAuxiliary": ["has", "had"],
|
|
90
|
+
"weakMannerAdverb": [
|
|
91
|
+
"quietly",
|
|
92
|
+
"silently",
|
|
93
|
+
"subtly",
|
|
94
|
+
"gradually",
|
|
95
|
+
"steadily",
|
|
96
|
+
"almost invisibly",
|
|
97
|
+
"under the surface"
|
|
98
|
+
],
|
|
99
|
+
"finiteChange": [
|
|
100
|
+
"changes",
|
|
101
|
+
"shifts",
|
|
102
|
+
"evolves",
|
|
103
|
+
"transforms",
|
|
104
|
+
"reshapes",
|
|
105
|
+
"redefines",
|
|
106
|
+
"moves",
|
|
107
|
+
"changed",
|
|
108
|
+
"shifted",
|
|
109
|
+
"evolved",
|
|
110
|
+
"transformed",
|
|
111
|
+
"reshaped",
|
|
112
|
+
"redefined",
|
|
113
|
+
"moved"
|
|
114
|
+
],
|
|
115
|
+
"pastChange": [
|
|
116
|
+
"changed",
|
|
117
|
+
"shifted",
|
|
118
|
+
"evolved",
|
|
119
|
+
"transformed",
|
|
120
|
+
"reshaped",
|
|
121
|
+
"redefined",
|
|
122
|
+
"moved"
|
|
123
|
+
],
|
|
124
|
+
"progressiveChange": [
|
|
125
|
+
"changing",
|
|
126
|
+
"shifting",
|
|
127
|
+
"evolving",
|
|
128
|
+
"transforming",
|
|
129
|
+
"reshaping",
|
|
130
|
+
"redefining",
|
|
131
|
+
"moving"
|
|
132
|
+
],
|
|
133
|
+
"deicticSubject": ["this", "that", "it"],
|
|
134
|
+
"emptyChangeObject": [
|
|
135
|
+
"changes everything",
|
|
136
|
+
"changes the game",
|
|
137
|
+
"changes the equation",
|
|
138
|
+
"reshapes everything",
|
|
139
|
+
"redefines everything"
|
|
140
|
+
],
|
|
141
|
+
"shiftDeterminer": ["a", "the", "this", "that"],
|
|
142
|
+
"shiftModifier": [
|
|
143
|
+
"quiet",
|
|
144
|
+
"subtle",
|
|
145
|
+
"broader",
|
|
146
|
+
"meaningful",
|
|
147
|
+
"important",
|
|
148
|
+
"major",
|
|
149
|
+
"fundamental",
|
|
150
|
+
"seismic",
|
|
151
|
+
"structural",
|
|
152
|
+
"profound",
|
|
153
|
+
"significant",
|
|
154
|
+
"notable"
|
|
155
|
+
],
|
|
156
|
+
"emptyShiftPredicate": [
|
|
157
|
+
"is underway",
|
|
158
|
+
"is happening",
|
|
159
|
+
"has begun",
|
|
160
|
+
"is already here",
|
|
161
|
+
"is easy to miss",
|
|
162
|
+
"is hard to ignore",
|
|
163
|
+
"matters",
|
|
164
|
+
"changes everything"
|
|
165
|
+
],
|
|
166
|
+
"signalVerb": ["marks", "signals", "represents", "reflects"]
|
|
49
167
|
},
|
|
50
168
|
"rejectIf": [
|
|
51
169
|
"sentence names what changed",
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { defineTextlintRule } from "../../adapters/textlint/rule.js";
|
|
2
|
-
import { documentUnit } from "../../adapters/textlint/units.js";
|
|
3
1
|
import { ERROR_SEVERITY } from "../../reporting/density.js";
|
|
4
|
-
import {
|
|
2
|
+
import { defineExactTokenDensityRule } from "./private/token-density-rule.js";
|
|
5
3
|
// The rule only detects occurrences of "actually" - one detection per use, no counting,
|
|
6
4
|
// rate, or severity. The density-rate report policy below lets the reporter judge the
|
|
7
5
|
// occurrences against the document word count and decide none / warning / error.
|
|
@@ -9,20 +7,8 @@ import { wordTokens } from "../../shared/text/tokens.js";
|
|
|
9
7
|
// density, which is the reporter's concern, not the detector's. See src/reporting/density.ts.
|
|
10
8
|
const TARGET = "actually";
|
|
11
9
|
const RULE_ID = "words:actually-overuse";
|
|
12
|
-
const rule =
|
|
13
|
-
|
|
14
|
-
detect: ({ units }) => units.flatMap((unit) => wordTokens(unit.text)
|
|
15
|
-
.filter((token) => token.normalized === TARGET)
|
|
16
|
-
.map((token) => ({
|
|
17
|
-
evidence: TARGET,
|
|
18
|
-
label: TARGET,
|
|
19
|
-
range: { end: token.end, start: token.start },
|
|
20
|
-
ruleId: RULE_ID,
|
|
21
|
-
unitId: unit.id
|
|
22
|
-
}))),
|
|
23
|
-
family: "words",
|
|
24
|
-
id: RULE_ID
|
|
25
|
-
},
|
|
10
|
+
const rule = defineExactTokenDensityRule({
|
|
11
|
+
errorPerUnit: 2,
|
|
26
12
|
formatMessage: (report) => {
|
|
27
13
|
const count = report.metric?.["count"] ?? report.detections.length;
|
|
28
14
|
const perUnit = report.metric?.["perUnit"] ?? 0;
|
|
@@ -31,15 +17,11 @@ const rule = defineTextlintRule({
|
|
|
31
17
|
: "above the 1-per-1,000-word warning threshold";
|
|
32
18
|
return `"actually" used ${count} times (${perUnit} per 1,000 words), ${threshold}. Cut the filler uses; keep at most about one per 1,000 words.`;
|
|
33
19
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
warningPerUnit: 1,
|
|
40
|
-
wordsPerUnit: 1000
|
|
41
|
-
},
|
|
42
|
-
units: (document) => [documentUnit(document)]
|
|
20
|
+
minimumOccurrences: 2,
|
|
21
|
+
ruleId: RULE_ID,
|
|
22
|
+
target: TARGET,
|
|
23
|
+
warningPerUnit: 1,
|
|
24
|
+
wordsPerUnit: 1000
|
|
43
25
|
});
|
|
44
26
|
export default rule;
|
|
45
27
|
//# sourceMappingURL=actually-overuse.js.map
|