slopless 0.1.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/README.md +64 -0
- package/dist/families/metrics/avg-sentence-length.js +22 -0
- package/dist/families/metrics/avg-sentence-length.js.map +1 -0
- package/dist/families/metrics/coleman-liau.js +27 -0
- package/dist/families/metrics/coleman-liau.js.map +1 -0
- package/dist/families/metrics/flesch-kincaid.js +27 -0
- package/dist/families/metrics/flesch-kincaid.js.map +1 -0
- package/dist/families/metrics/gunning-fog.js +27 -0
- package/dist/families/metrics/gunning-fog.js.map +1 -0
- package/dist/families/metrics/paragraph-length.js +21 -0
- package/dist/families/metrics/paragraph-length.js.map +1 -0
- package/dist/families/metrics/word-repetition.js +46 -0
- package/dist/families/metrics/word-repetition.js.map +1 -0
- package/dist/families/orthography/colon-dramatic.js +117 -0
- package/dist/families/orthography/colon-dramatic.js.map +1 -0
- package/dist/families/orthography/em-dashes.js +41 -0
- package/dist/families/orthography/em-dashes.js.map +1 -0
- package/dist/families/orthography/exclamation-density.js +51 -0
- package/dist/families/orthography/exclamation-density.js.map +1 -0
- package/dist/families/orthography/fake-timestamps.js +103 -0
- package/dist/families/orthography/fake-timestamps.js.map +1 -0
- package/dist/families/orthography/sentence-case.js +66 -0
- package/dist/families/orthography/sentence-case.js.map +1 -0
- package/dist/families/orthography/smart-quotes.js +53 -0
- package/dist/families/orthography/smart-quotes.js.map +1 -0
- package/dist/families/phrases/cliches.js +17 -0
- package/dist/families/phrases/cliches.js.map +1 -0
- package/dist/families/phrases/corporate-speak.js +23 -0
- package/dist/families/phrases/corporate-speak.js.map +1 -0
- package/dist/families/phrases/data/cliches.json +699 -0
- package/dist/families/phrases/data/corporate-speak.json +27 -0
- package/dist/families/phrases/data/prohibited-phrases.json +8 -0
- package/dist/families/phrases/data/skunked-terms.json +10 -0
- package/dist/families/phrases/data/uncomparables.json +57 -0
- package/dist/families/phrases/humble-bragger.js +26 -0
- package/dist/families/phrases/humble-bragger.js.map +1 -0
- package/dist/families/phrases/jargon-faker.js +84 -0
- package/dist/families/phrases/jargon-faker.js.map +1 -0
- package/dist/families/phrases/llm-disclaimer.js +54 -0
- package/dist/families/phrases/llm-disclaimer.js.map +1 -0
- package/dist/families/phrases/prohibited-phrases.js +17 -0
- package/dist/families/phrases/prohibited-phrases.js.map +1 -0
- package/dist/families/phrases/skunked-terms.js +23 -0
- package/dist/families/phrases/skunked-terms.js.map +1 -0
- package/dist/families/phrases/uncomparables.js +78 -0
- package/dist/families/phrases/uncomparables.js.map +1 -0
- package/dist/families/semantic-thinness/patterns/abstract-contrast.json +85 -0
- package/dist/families/semantic-thinness/patterns/abstract-metaphor-claim.json +112 -0
- package/dist/families/semantic-thinness/patterns/body-emotion-shorthand.json +77 -0
- package/dist/families/semantic-thinness/patterns/body-knows.json +80 -0
- package/dist/families/semantic-thinness/patterns/deictic-summary.json +109 -0
- package/dist/families/semantic-thinness/patterns/empty-atmosphere-shift.json +70 -0
- package/dist/families/semantic-thinness/patterns/empty-emotional-weather.json +104 -0
- package/dist/families/semantic-thinness/patterns/empty-scene-state.json +117 -0
- package/dist/families/semantic-thinness/patterns/empty-scene-transition.json +98 -0
- package/dist/families/semantic-thinness/patterns/gaze-choreography.json +87 -0
- package/dist/families/semantic-thinness/patterns/generic-lesson-extraction.json +82 -0
- package/dist/families/semantic-thinness/patterns/generic-pressure-or-stakes.json +107 -0
- package/dist/families/semantic-thinness/patterns/generic-realization.json +113 -0
- package/dist/families/semantic-thinness/patterns/hollow-significance.json +103 -0
- package/dist/families/semantic-thinness/patterns/low-information-physical-blocking.json +113 -0
- package/dist/families/semantic-thinness/patterns/point-is-frame.json +81 -0
- package/dist/families/semantic-thinness/patterns/real-work-begins.json +66 -0
- package/dist/families/semantic-thinness/patterns/silence-as-actor.json +69 -0
- package/dist/families/semantic-thinness/patterns/something-shifted.json +73 -0
- package/dist/families/semantic-thinness/patterns/truth-answer-moves.json +75 -0
- package/dist/families/semantic-thinness/patterns/vague-connective-payoff.json +90 -0
- package/dist/families/semantic-thinness/patterns/vague-threshold-change.json +98 -0
- package/dist/families/semantic-thinness/private/pattern-data-a.js +15 -0
- package/dist/families/semantic-thinness/private/pattern-data-a.js.map +1 -0
- package/dist/families/semantic-thinness/private/pattern-data-b.js +15 -0
- package/dist/families/semantic-thinness/private/pattern-data-b.js.map +1 -0
- package/dist/families/semantic-thinness/private/pattern-data-c.js +9 -0
- package/dist/families/semantic-thinness/private/pattern-data-c.js.map +1 -0
- package/dist/families/semantic-thinness/private/pattern-data-d.js +17 -0
- package/dist/families/semantic-thinness/private/pattern-data-d.js.map +1 -0
- package/dist/families/semantic-thinness/private/pattern-data.js +11 -0
- package/dist/families/semantic-thinness/private/pattern-data.js.map +1 -0
- package/dist/families/semantic-thinness/private/pattern-matcher.js +172 -0
- package/dist/families/semantic-thinness/private/pattern-matcher.js.map +1 -0
- package/dist/families/semantic-thinness/semantic-thinness.js +25 -0
- package/dist/families/semantic-thinness/semantic-thinness.js.map +1 -0
- package/dist/families/syntactic-patterns/authority/authority-padding.js +81 -0
- package/dist/families/syntactic-patterns/authority/authority-padding.js.map +1 -0
- package/dist/families/syntactic-patterns/closers/affirmation-closers.js +48 -0
- package/dist/families/syntactic-patterns/closers/affirmation-closers.js.map +1 -0
- package/dist/families/syntactic-patterns/closers/boilerplate-conclusion.js +131 -0
- package/dist/families/syntactic-patterns/closers/boilerplate-conclusion.js.map +1 -0
- package/dist/families/syntactic-patterns/closers/false-question.js +30 -0
- package/dist/families/syntactic-patterns/closers/false-question.js.map +1 -0
- package/dist/families/syntactic-patterns/closers/summative-closer.js +33 -0
- package/dist/families/syntactic-patterns/closers/summative-closer.js.map +1 -0
- package/dist/families/syntactic-patterns/contrast/blame-reframe.js +59 -0
- package/dist/families/syntactic-patterns/contrast/blame-reframe.js.map +1 -0
- package/dist/families/syntactic-patterns/contrast/contrastive-aphorism.js +203 -0
- package/dist/families/syntactic-patterns/contrast/contrastive-aphorism.js.map +1 -0
- package/dist/families/syntactic-patterns/contrast/negation-reframe.js +20 -0
- package/dist/families/syntactic-patterns/contrast/negation-reframe.js.map +1 -0
- package/dist/families/syntactic-patterns/contrast/private/negation-reframe-matcher.js +218 -0
- package/dist/families/syntactic-patterns/contrast/private/negation-reframe-matcher.js.map +1 -0
- package/dist/families/syntactic-patterns/contrast/private/negation-reframe-parts.js +136 -0
- package/dist/families/syntactic-patterns/contrast/private/negation-reframe-parts.js.map +1 -0
- package/dist/families/syntactic-patterns/generalization/softening-language.js +143 -0
- package/dist/families/syntactic-patterns/generalization/softening-language.js.map +1 -0
- package/dist/families/syntactic-patterns/generalization/universalizing-claims.js +137 -0
- package/dist/families/syntactic-patterns/generalization/universalizing-claims.js.map +1 -0
- package/dist/families/syntactic-patterns/lead-ins/boilerplate-framing.js +104 -0
- package/dist/families/syntactic-patterns/lead-ins/boilerplate-framing.js.map +1 -0
- package/dist/families/syntactic-patterns/lead-ins/generic-signposting.js +230 -0
- package/dist/families/syntactic-patterns/lead-ins/generic-signposting.js.map +1 -0
- package/dist/families/syntactic-patterns/lead-ins/lesson-framing.js +76 -0
- package/dist/families/syntactic-patterns/lead-ins/lesson-framing.js.map +1 -0
- package/dist/families/syntactic-patterns/lead-ins/llm-openers.js +24 -0
- package/dist/families/syntactic-patterns/lead-ins/llm-openers.js.map +1 -0
- package/dist/families/syntactic-patterns/lead-ins/observer-guidance.js +95 -0
- package/dist/families/syntactic-patterns/lead-ins/observer-guidance.js.map +1 -0
- package/dist/families/syntactic-patterns/llm-artifacts/response-wrapper.js +106 -0
- package/dist/families/syntactic-patterns/llm-artifacts/response-wrapper.js.map +1 -0
- package/dist/families/syntactic-patterns/repetition/demonstrative-emphasis.js +251 -0
- package/dist/families/syntactic-patterns/repetition/demonstrative-emphasis.js.map +1 -0
- package/dist/families/syntactic-patterns/repetition/empty-emphasis.js +108 -0
- package/dist/families/syntactic-patterns/repetition/empty-emphasis.js.map +1 -0
- package/dist/families/syntactic-patterns/repetition/fragment-stacking.js +306 -0
- package/dist/families/syntactic-patterns/repetition/fragment-stacking.js.map +1 -0
- package/dist/families/syntactic-patterns/repetition/triple-repeat.js +149 -0
- package/dist/families/syntactic-patterns/repetition/triple-repeat.js.map +1 -0
- package/dist/families/term-policy/recommended-terms.js +87 -0
- package/dist/families/term-policy/recommended-terms.js.map +1 -0
- package/dist/families/term-policy/required-terms.js +32 -0
- package/dist/families/term-policy/required-terms.js.map +1 -0
- package/dist/families/words/data/prohibited-words.json +12 -0
- package/dist/families/words/data/simplicity-pairs.json +7 -0
- package/dist/families/words/hedge-stacking.js +43 -0
- package/dist/families/words/hedge-stacking.js.map +1 -0
- package/dist/families/words/llm-vocabulary.js +33 -0
- package/dist/families/words/llm-vocabulary.js.map +1 -0
- package/dist/families/words/prohibited-words.js +17 -0
- package/dist/families/words/prohibited-words.js.map +1 -0
- package/dist/families/words/simplicity.js +27 -0
- package/dist/families/words/simplicity.js.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/presets/everything.js +52 -0
- package/dist/presets/everything.js.map +1 -0
- package/dist/registries/metrics.js +15 -0
- package/dist/registries/metrics.js.map +1 -0
- package/dist/registries/orthography.js +15 -0
- package/dist/registries/orthography.js.map +1 -0
- package/dist/registries/phrases.js +19 -0
- package/dist/registries/phrases.js.map +1 -0
- package/dist/registries/semantic-thinness.js +5 -0
- package/dist/registries/semantic-thinness.js.map +1 -0
- package/dist/registries/syntactic-patterns/authority.js +5 -0
- package/dist/registries/syntactic-patterns/authority.js.map +1 -0
- package/dist/registries/syntactic-patterns/closers.js +11 -0
- package/dist/registries/syntactic-patterns/closers.js.map +1 -0
- package/dist/registries/syntactic-patterns/contrast.js +9 -0
- package/dist/registries/syntactic-patterns/contrast.js.map +1 -0
- package/dist/registries/syntactic-patterns/generalization.js +7 -0
- package/dist/registries/syntactic-patterns/generalization.js.map +1 -0
- package/dist/registries/syntactic-patterns/lead-ins.js +13 -0
- package/dist/registries/syntactic-patterns/lead-ins.js.map +1 -0
- package/dist/registries/syntactic-patterns/llm-artifacts.js +5 -0
- package/dist/registries/syntactic-patterns/llm-artifacts.js.map +1 -0
- package/dist/registries/syntactic-patterns/repetition.js +11 -0
- package/dist/registries/syntactic-patterns/repetition.js.map +1 -0
- package/dist/registries/syntactic-patterns.js +17 -0
- package/dist/registries/syntactic-patterns.js.map +1 -0
- package/dist/registries/term-policy.js +7 -0
- package/dist/registries/term-policy.js.map +1 -0
- package/dist/registries/words.js +11 -0
- package/dist/registries/words.js.map +1 -0
- package/dist/shared/matchers/phrases.js +71 -0
- package/dist/shared/matchers/phrases.js.map +1 -0
- package/dist/shared/matchers/prose-patterns.js +104 -0
- package/dist/shared/matchers/prose-patterns.js.map +1 -0
- package/dist/shared/text/document.js +18 -0
- package/dist/shared/text/document.js.map +1 -0
- package/dist/shared/text/normalize.js +30 -0
- package/dist/shared/text/normalize.js.map +1 -0
- package/dist/shared/text/quotes.js +20 -0
- package/dist/shared/text/quotes.js.map +1 -0
- package/dist/shared/text/sections.js +119 -0
- package/dist/shared/text/sections.js.map +1 -0
- package/dist/shared/text/sentences.js +79 -0
- package/dist/shared/text/sentences.js.map +1 -0
- package/dist/shared/text/tokens.js +18 -0
- package/dist/shared/text/tokens.js.map +1 -0
- package/dist/shared/text/traverse.js +10 -0
- package/dist/shared/text/traverse.js.map +1 -0
- package/dist/shared/text/whitespace.js +25 -0
- package/dist/shared/text/whitespace.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommended-terms.js","sourceRoot":"","sources":["../../../src/families/term-policy/recommended-terms.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAczD,MAAM,QAAQ,GAAG;IACf,OAAO;IACP,MAAM;IACN,MAAM;IACN,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OAAO;YACT,CAAC;YAED,MAAM,CACJ,IAAI,EACJ,IAAI,SAAS,CACX,8BAA8B,KAAK,sBAAsB,MAAM,CAAC,QAAQ,8BAA8B,EACtG;gBACE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;aACvB,CACF,CACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { documentText } from "../../shared/text/document.js";
|
|
2
|
+
import { normalizeForMatch } from "../../shared/text/normalize.js";
|
|
3
|
+
import { wordTokens } from "../../shared/text/tokens.js";
|
|
4
|
+
function presentTerms(text) {
|
|
5
|
+
return new Set(wordTokens(text).map((token) => token.normalized));
|
|
6
|
+
}
|
|
7
|
+
function configuredTerms(options) {
|
|
8
|
+
return (options.terms?.map(normalizeForMatch).filter((term) => term.length > 0) ??
|
|
9
|
+
[]);
|
|
10
|
+
}
|
|
11
|
+
const rule = (context, options = {}) => {
|
|
12
|
+
const { Syntax, RuleError, locator, report } = context;
|
|
13
|
+
return {
|
|
14
|
+
[Syntax.Document](node) {
|
|
15
|
+
const requiredTerms = configuredTerms(options);
|
|
16
|
+
if (requiredTerms.length === 0) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const terms = presentTerms(documentText(node));
|
|
20
|
+
for (const term of requiredTerms) {
|
|
21
|
+
if (terms.has(term)) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
report(node, new RuleError(`Required term missing: "${term}". Add the term or update the policy.`, {
|
|
25
|
+
padding: locator.at(0)
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export default rule;
|
|
32
|
+
//# sourceMappingURL=required-terms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"required-terms.js","sourceRoot":"","sources":["../../../src/families/term-policy/required-terms.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AC,EAAE,CAAC,CAAC,CAAC;iBACvB,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { allParagraphSentences } from "../../shared/text/sections.js";
|
|
2
|
+
import { wordTokens } from "../../shared/text/tokens.js";
|
|
3
|
+
const HEDGE_THRESHOLD = 2;
|
|
4
|
+
const HEDGE_WORDS = new Set([
|
|
5
|
+
"might",
|
|
6
|
+
"maybe",
|
|
7
|
+
"perhaps",
|
|
8
|
+
"possibly",
|
|
9
|
+
"likely",
|
|
10
|
+
"probably",
|
|
11
|
+
"seems",
|
|
12
|
+
"apparently"
|
|
13
|
+
]);
|
|
14
|
+
function hedgeCount(text) {
|
|
15
|
+
let count = 0;
|
|
16
|
+
for (const token of wordTokens(text)) {
|
|
17
|
+
if (HEDGE_WORDS.has(token.normalized)) {
|
|
18
|
+
count += 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return count;
|
|
22
|
+
}
|
|
23
|
+
const rule = (context) => {
|
|
24
|
+
const { Syntax, RuleError, locator, report } = context;
|
|
25
|
+
return {
|
|
26
|
+
[Syntax.Document](node) {
|
|
27
|
+
for (const item of allParagraphSentences(node)) {
|
|
28
|
+
const count = hedgeCount(item.sentence.text);
|
|
29
|
+
if (count < HEDGE_THRESHOLD) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
report(item.paragraph, new RuleError(`Hedge stacking found: ${count} hedge words in one sentence. Keep fewer than ${HEDGE_THRESHOLD}.`, {
|
|
33
|
+
padding: locator.range([
|
|
34
|
+
item.source.originalStartFor(item.sentence.start),
|
|
35
|
+
item.source.originalEndFor(item.sentence.end)
|
|
36
|
+
])
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export default rule;
|
|
43
|
+
//# sourceMappingURL=hedge-stacking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hedge-stacking.js","sourceRoot":"","sources":["../../../src/families/words/hedge-stacking.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,OAAO;IACP,OAAO;IACP,SAAS;IACT,UAAU;IACV,QAAQ;IACR,UAAU;IACV,OAAO;IACP,YAAY;CACb,CAAC,CAAC;AAEH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YACtC,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,IAAI,GAAuB,CAAC,OAAO,EAAE,EAAE;IAC3C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEvD,OAAO;QACL,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAqB;YACrC,KAAK,MAAM,IAAI,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAE7C,IAAI,KAAK,GAAG,eAAe,EAAE,CAAC;oBAC5B,SAAS;gBACX,CAAC;gBAED,MAAM,CACJ,IAAI,CAAC,SAAS,EACd,IAAI,SAAS,CACX,yBAAyB,KAAK,iDAAiD,eAAe,GAAG,EACjG;oBACE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;wBACrB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;wBACjD,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;qBAC9C,CAAC;iBACH,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { wordTokens } from "../../shared/text/tokens.js";
|
|
2
|
+
const LLM_VOCABULARY = new Set([
|
|
3
|
+
"delve",
|
|
4
|
+
"vibrant",
|
|
5
|
+
"landscape",
|
|
6
|
+
"realm",
|
|
7
|
+
"embark",
|
|
8
|
+
"excels",
|
|
9
|
+
"vital",
|
|
10
|
+
"comprehensive",
|
|
11
|
+
"intricate",
|
|
12
|
+
"pivotal",
|
|
13
|
+
"moreover",
|
|
14
|
+
"tapestry"
|
|
15
|
+
]);
|
|
16
|
+
const rule = (context) => {
|
|
17
|
+
const { Syntax, RuleError, getSource, locator, report } = context;
|
|
18
|
+
return {
|
|
19
|
+
[Syntax.Str](node) {
|
|
20
|
+
const text = getSource(node);
|
|
21
|
+
for (const token of wordTokens(text)) {
|
|
22
|
+
if (!LLM_VOCABULARY.has(token.normalized)) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
report(node, new RuleError(`LLM vocabulary found: "${token.text}". Replace the stock diction with a concrete word.`, {
|
|
26
|
+
padding: locator.range([token.start, token.end])
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default rule;
|
|
33
|
+
//# sourceMappingURL=llm-vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-vocabulary.js","sourceRoot":"","sources":["../../../src/families/words/llm-vocabulary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,OAAO;IACP,SAAS;IACT,WAAW;IACX,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,eAAe;IACf,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAEH,MAAM,IAAI,GAAuB,CAAC,OAAO,EAAE,EAAE;IAC3C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAElE,OAAO;QACL,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI;YACf,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAE7B,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC1C,SAAS;gBACX,CAAC;gBAED,MAAM,CACJ,IAAI,EACJ,IAAI,SAAS,CACX,0BAA0B,KAAK,CAAC,IAAI,oDAAoD,EACxF;oBACE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;iBACjD,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import prohibitedWords from "./data/prohibited-words.json" with { type: "json" };
|
|
2
|
+
import { findPhraseMatches } from "../../shared/matchers/phrases.js";
|
|
3
|
+
const rule = (context) => {
|
|
4
|
+
const { Syntax, RuleError, getSource, locator, report } = context;
|
|
5
|
+
return {
|
|
6
|
+
[Syntax.Str](node) {
|
|
7
|
+
const text = getSource(node);
|
|
8
|
+
for (const match of findPhraseMatches(text, prohibitedWords)) {
|
|
9
|
+
report(node, new RuleError(`Prohibited word found: "${match.text}". Rewrite without this term.`, {
|
|
10
|
+
padding: locator.range([match.start, match.end])
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default rule;
|
|
17
|
+
//# sourceMappingURL=prohibited-words.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prohibited-words.js","sourceRoot":"","sources":["../../../src/families/words/prohibited-words.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,8BAA8B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,IAAI,GAAuB,CAAC,OAAO,EAAE,EAAE;IAC3C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAElE,OAAO;QACL,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI;YACf,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAE7B,KAAK,MAAM,KAAK,IAAI,iBAAiB,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE,CAAC;gBAC7D,MAAM,CACJ,IAAI,EACJ,IAAI,SAAS,CACX,2BAA2B,KAAK,CAAC,IAAI,+BAA+B,EACpE;oBACE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;iBACjD,CACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import simplicityPairs from "./data/simplicity-pairs.json" with { type: "json" };
|
|
2
|
+
import { allParagraphSentences } from "../../shared/text/sections.js";
|
|
3
|
+
import { wordTokens } from "../../shared/text/tokens.js";
|
|
4
|
+
const SIMPLE_BY_COMPLEX = new Map(simplicityPairs.map(([complex, simple]) => [complex, simple]));
|
|
5
|
+
const rule = (context) => {
|
|
6
|
+
const { Syntax, RuleError, locator, report } = context;
|
|
7
|
+
return {
|
|
8
|
+
[Syntax.Document](node) {
|
|
9
|
+
for (const item of allParagraphSentences(node)) {
|
|
10
|
+
for (const token of wordTokens(item.sentence.text)) {
|
|
11
|
+
const simple = SIMPLE_BY_COMPLEX.get(token.normalized);
|
|
12
|
+
if (simple === undefined) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
report(item.paragraph, new RuleError(`Complex word found: "${token.text}". Use "${simple}" instead.`, {
|
|
16
|
+
padding: locator.range([
|
|
17
|
+
item.source.originalStartFor(item.sentence.start + token.start),
|
|
18
|
+
item.source.originalEndFor(item.sentence.start + token.end)
|
|
19
|
+
])
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export default rule;
|
|
27
|
+
//# sourceMappingURL=simplicity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simplicity.js","sourceRoot":"","sources":["../../../src/families/words/simplicity.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,8BAA8B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAC/B,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAC9D,CAAC;AAEF,MAAM,IAAI,GAAuB,CAAC,OAAO,EAAE,EAAE;IAC3C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEvD,OAAO;QACL,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAqB;YACrC,KAAK,MAAM,IAAI,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/C,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBACnD,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;oBAEvD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;wBACzB,SAAS;oBACX,CAAC;oBAED,MAAM,CACJ,IAAI,CAAC,SAAS,EACd,IAAI,SAAS,CACX,wBAAwB,KAAK,CAAC,IAAI,WAAW,MAAM,YAAY,EAC/D;wBACE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;4BACrB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAClC;4BACD,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;yBAC5D,CAAC;qBACH,CACF,CACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { everything } from "./presets/everything.js";
|
|
2
|
+
import { metricRules } from "./registries/metrics.js";
|
|
3
|
+
import { orthographyRules } from "./registries/orthography.js";
|
|
4
|
+
import { phraseRules } from "./registries/phrases.js";
|
|
5
|
+
import { semanticThinnessRules } from "./registries/semantic-thinness.js";
|
|
6
|
+
import { syntacticPatternRules } from "./registries/syntactic-patterns.js";
|
|
7
|
+
import { termPolicyRules } from "./registries/term-policy.js";
|
|
8
|
+
import { wordRules } from "./registries/words.js";
|
|
9
|
+
export const rules = {
|
|
10
|
+
...metricRules,
|
|
11
|
+
...orthographyRules,
|
|
12
|
+
...phraseRules,
|
|
13
|
+
...semanticThinnessRules,
|
|
14
|
+
...syntacticPatternRules,
|
|
15
|
+
...termPolicyRules,
|
|
16
|
+
...wordRules
|
|
17
|
+
};
|
|
18
|
+
export const presets = {
|
|
19
|
+
everything
|
|
20
|
+
};
|
|
21
|
+
export const rulesConfig = everything.rules;
|
|
22
|
+
export default {
|
|
23
|
+
rules,
|
|
24
|
+
rulesConfig
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,GAAG,WAAW;IACd,GAAG,gBAAgB;IACnB,GAAG,WAAW;IACd,GAAG,qBAAqB;IACxB,GAAG,qBAAqB;IACxB,GAAG,eAAe;IAClB,GAAG,SAAS;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC;AAE5C,eAAe;IACb,KAAK;IACL,WAAW;CACZ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const everything = {
|
|
2
|
+
rules: {
|
|
3
|
+
"affirmation-closers": true,
|
|
4
|
+
"authority-padding": true,
|
|
5
|
+
"avg-sentence-length": true,
|
|
6
|
+
"blame-reframe": true,
|
|
7
|
+
"boilerplate-conclusion": true,
|
|
8
|
+
"boilerplate-framing": true,
|
|
9
|
+
cliches: true,
|
|
10
|
+
"colon-dramatic": true,
|
|
11
|
+
"coleman-liau": true,
|
|
12
|
+
"corporate-speak": true,
|
|
13
|
+
"contrastive-aphorism": true,
|
|
14
|
+
"demonstrative-emphasis": true,
|
|
15
|
+
"em-dashes": true,
|
|
16
|
+
"empty-emphasis": true,
|
|
17
|
+
"exclamation-density": true,
|
|
18
|
+
"fake-timestamps": true,
|
|
19
|
+
"false-question": true,
|
|
20
|
+
"flesch-kincaid": true,
|
|
21
|
+
"fragment-stacking": true,
|
|
22
|
+
"gunning-fog": true,
|
|
23
|
+
"hedge-stacking": true,
|
|
24
|
+
"humble-bragger": true,
|
|
25
|
+
"jargon-faker": true,
|
|
26
|
+
"generic-signposting": true,
|
|
27
|
+
"lesson-framing": true,
|
|
28
|
+
"llm-disclaimer": true,
|
|
29
|
+
"llm-openers": true,
|
|
30
|
+
"llm-vocabulary": true,
|
|
31
|
+
"negation-reframe": true,
|
|
32
|
+
"observer-guidance": true,
|
|
33
|
+
"paragraph-length": true,
|
|
34
|
+
"prohibited-phrases": true,
|
|
35
|
+
"prohibited-words": true,
|
|
36
|
+
"recommended-terms": true,
|
|
37
|
+
"response-wrapper": true,
|
|
38
|
+
"required-terms": true,
|
|
39
|
+
"sentence-case": true,
|
|
40
|
+
"semantic-thinness": true,
|
|
41
|
+
simplicity: true,
|
|
42
|
+
"skunked-terms": true,
|
|
43
|
+
"softening-language": true,
|
|
44
|
+
"smart-quotes": true,
|
|
45
|
+
"summative-closer": true,
|
|
46
|
+
"triple-repeat": true,
|
|
47
|
+
uncomparables: true,
|
|
48
|
+
"universalizing-claims": true,
|
|
49
|
+
"word-repetition": true
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=everything.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"everything.js","sourceRoot":"","sources":["../../src/presets/everything.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE;QACL,qBAAqB,EAAE,IAAI;QAC3B,mBAAmB,EAAE,IAAI;QACzB,qBAAqB,EAAE,IAAI;QAC3B,eAAe,EAAE,IAAI;QACrB,wBAAwB,EAAE,IAAI;QAC9B,qBAAqB,EAAE,IAAI;QAC3B,OAAO,EAAE,IAAI;QACb,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,IAAI;QACpB,iBAAiB,EAAE,IAAI;QACvB,sBAAsB,EAAE,IAAI;QAC5B,wBAAwB,EAAE,IAAI;QAC9B,WAAW,EAAE,IAAI;QACjB,gBAAgB,EAAE,IAAI;QACtB,qBAAqB,EAAE,IAAI;QAC3B,iBAAiB,EAAE,IAAI;QACvB,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,IAAI;QACtB,mBAAmB,EAAE,IAAI;QACzB,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,IAAI;QACpB,qBAAqB,EAAE,IAAI;QAC3B,gBAAgB,EAAE,IAAI;QACtB,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,IAAI;QACxB,mBAAmB,EAAE,IAAI;QACzB,kBAAkB,EAAE,IAAI;QACxB,oBAAoB,EAAE,IAAI;QAC1B,kBAAkB,EAAE,IAAI;QACxB,mBAAmB,EAAE,IAAI;QACzB,kBAAkB,EAAE,IAAI;QACxB,gBAAgB,EAAE,IAAI;QACtB,eAAe,EAAE,IAAI;QACrB,mBAAmB,EAAE,IAAI;QACzB,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,IAAI;QACrB,oBAAoB,EAAE,IAAI;QAC1B,cAAc,EAAE,IAAI;QACpB,kBAAkB,EAAE,IAAI;QACxB,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,uBAAuB,EAAE,IAAI;QAC7B,iBAAiB,EAAE,IAAI;KACxB;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import avgSentenceLength from "../families/metrics/avg-sentence-length.js";
|
|
2
|
+
import colemanLiau from "../families/metrics/coleman-liau.js";
|
|
3
|
+
import fleschKincaid from "../families/metrics/flesch-kincaid.js";
|
|
4
|
+
import gunningFog from "../families/metrics/gunning-fog.js";
|
|
5
|
+
import paragraphLength from "../families/metrics/paragraph-length.js";
|
|
6
|
+
import wordRepetition from "../families/metrics/word-repetition.js";
|
|
7
|
+
export const metricRules = {
|
|
8
|
+
"avg-sentence-length": avgSentenceLength,
|
|
9
|
+
"coleman-liau": colemanLiau,
|
|
10
|
+
"flesch-kincaid": fleschKincaid,
|
|
11
|
+
"gunning-fog": gunningFog,
|
|
12
|
+
"paragraph-length": paragraphLength,
|
|
13
|
+
"word-repetition": wordRepetition
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/registries/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,4CAA4C,CAAC;AAC3E,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,eAAe,MAAM,yCAAyC,CAAC;AACtE,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,qBAAqB,EAAE,iBAAiB;IACxC,cAAc,EAAE,WAAW;IAC3B,gBAAgB,EAAE,aAAa;IAC/B,aAAa,EAAE,UAAU;IACzB,kBAAkB,EAAE,eAAe;IACnC,iBAAiB,EAAE,cAAc;CAClC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import colonDramatic from "../families/orthography/colon-dramatic.js";
|
|
2
|
+
import emDashes from "../families/orthography/em-dashes.js";
|
|
3
|
+
import exclamationDensity from "../families/orthography/exclamation-density.js";
|
|
4
|
+
import fakeTimestamps from "../families/orthography/fake-timestamps.js";
|
|
5
|
+
import sentenceCase from "../families/orthography/sentence-case.js";
|
|
6
|
+
import smartQuotes from "../families/orthography/smart-quotes.js";
|
|
7
|
+
export const orthographyRules = {
|
|
8
|
+
"colon-dramatic": colonDramatic,
|
|
9
|
+
"em-dashes": emDashes,
|
|
10
|
+
"exclamation-density": exclamationDensity,
|
|
11
|
+
"fake-timestamps": fakeTimestamps,
|
|
12
|
+
"sentence-case": sentenceCase,
|
|
13
|
+
"smart-quotes": smartQuotes
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=orthography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orthography.js","sourceRoot":"","sources":["../../src/registries/orthography.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,2CAA2C,CAAC;AACtE,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAC5D,OAAO,kBAAkB,MAAM,gDAAgD,CAAC;AAChF,OAAO,cAAc,MAAM,4CAA4C,CAAC;AACxE,OAAO,YAAY,MAAM,0CAA0C,CAAC;AACpE,OAAO,WAAW,MAAM,yCAAyC,CAAC;AAElE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB,EAAE,aAAa;IAC/B,WAAW,EAAE,QAAQ;IACrB,qBAAqB,EAAE,kBAAkB;IACzC,iBAAiB,EAAE,cAAc;IACjC,eAAe,EAAE,YAAY;IAC7B,cAAc,EAAE,WAAW;CAC5B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import cliches from "../families/phrases/cliches.js";
|
|
2
|
+
import corporateSpeak from "../families/phrases/corporate-speak.js";
|
|
3
|
+
import humbleBragger from "../families/phrases/humble-bragger.js";
|
|
4
|
+
import jargonFaker from "../families/phrases/jargon-faker.js";
|
|
5
|
+
import llmDisclaimer from "../families/phrases/llm-disclaimer.js";
|
|
6
|
+
import prohibitedPhrases from "../families/phrases/prohibited-phrases.js";
|
|
7
|
+
import skunkedTerms from "../families/phrases/skunked-terms.js";
|
|
8
|
+
import uncomparables from "../families/phrases/uncomparables.js";
|
|
9
|
+
export const phraseRules = {
|
|
10
|
+
cliches,
|
|
11
|
+
"corporate-speak": corporateSpeak,
|
|
12
|
+
"humble-bragger": humbleBragger,
|
|
13
|
+
"jargon-faker": jargonFaker,
|
|
14
|
+
"llm-disclaimer": llmDisclaimer,
|
|
15
|
+
"prohibited-phrases": prohibitedPhrases,
|
|
16
|
+
"skunked-terms": skunkedTerms,
|
|
17
|
+
uncomparables
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=phrases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phrases.js","sourceRoot":"","sources":["../../src/registries/phrases.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gCAAgC,CAAC;AACrD,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,iBAAiB,MAAM,2CAA2C,CAAC;AAC1E,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,aAAa,MAAM,sCAAsC,CAAC;AAEjE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO;IACP,iBAAiB,EAAE,cAAc;IACjC,gBAAgB,EAAE,aAAa;IAC/B,cAAc,EAAE,WAAW;IAC3B,gBAAgB,EAAE,aAAa;IAC/B,oBAAoB,EAAE,iBAAiB;IACvC,eAAe,EAAE,YAAY;IAC7B,aAAa;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-thinness.js","sourceRoot":"","sources":["../../src/registries/semantic-thinness.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,oDAAoD,CAAC;AAElF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,mBAAmB,EAAE,gBAAgB;CACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority.js","sourceRoot":"","sources":["../../../src/registries/syntactic-patterns/authority.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,kEAAkE,CAAC;AAEhG,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB,EAAE,gBAAgB;CACtC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import affirmationClosers from "../../families/syntactic-patterns/closers/affirmation-closers.js";
|
|
2
|
+
import boilerplateConclusion from "../../families/syntactic-patterns/closers/boilerplate-conclusion.js";
|
|
3
|
+
import falseQuestion from "../../families/syntactic-patterns/closers/false-question.js";
|
|
4
|
+
import summativeCloser from "../../families/syntactic-patterns/closers/summative-closer.js";
|
|
5
|
+
export const closerRules = {
|
|
6
|
+
"affirmation-closers": affirmationClosers,
|
|
7
|
+
"boilerplate-conclusion": boilerplateConclusion,
|
|
8
|
+
"false-question": falseQuestion,
|
|
9
|
+
"summative-closer": summativeCloser
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=closers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closers.js","sourceRoot":"","sources":["../../../src/registries/syntactic-patterns/closers.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,kEAAkE,CAAC;AAClG,OAAO,qBAAqB,MAAM,qEAAqE,CAAC;AACxG,OAAO,aAAa,MAAM,6DAA6D,CAAC;AACxF,OAAO,eAAe,MAAM,+DAA+D,CAAC;AAE5F,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,qBAAqB,EAAE,kBAAkB;IACzC,wBAAwB,EAAE,qBAAqB;IAC/C,gBAAgB,EAAE,aAAa;IAC/B,kBAAkB,EAAE,eAAe;CACpC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import blameReframe from "../../families/syntactic-patterns/contrast/blame-reframe.js";
|
|
2
|
+
import contrastiveAphorism from "../../families/syntactic-patterns/contrast/contrastive-aphorism.js";
|
|
3
|
+
import negationReframe from "../../families/syntactic-patterns/contrast/negation-reframe.js";
|
|
4
|
+
export const contrastRules = {
|
|
5
|
+
"blame-reframe": blameReframe,
|
|
6
|
+
"contrastive-aphorism": contrastiveAphorism,
|
|
7
|
+
"negation-reframe": negationReframe
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=contrast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrast.js","sourceRoot":"","sources":["../../../src/registries/syntactic-patterns/contrast.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,6DAA6D,CAAC;AACvF,OAAO,mBAAmB,MAAM,oEAAoE,CAAC;AACrG,OAAO,eAAe,MAAM,gEAAgE,CAAC;AAE7F,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,eAAe,EAAE,YAAY;IAC7B,sBAAsB,EAAE,mBAAmB;IAC3C,kBAAkB,EAAE,eAAe;CACpC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import softeningLanguage from "../../families/syntactic-patterns/generalization/softening-language.js";
|
|
2
|
+
import universalizingClaims from "../../families/syntactic-patterns/generalization/universalizing-claims.js";
|
|
3
|
+
export const generalizationRules = {
|
|
4
|
+
"softening-language": softeningLanguage,
|
|
5
|
+
"universalizing-claims": universalizingClaims
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=generalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generalization.js","sourceRoot":"","sources":["../../../src/registries/syntactic-patterns/generalization.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,wEAAwE,CAAC;AACvG,OAAO,oBAAoB,MAAM,2EAA2E,CAAC;AAE7G,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,oBAAoB,EAAE,iBAAiB;IACvC,uBAAuB,EAAE,oBAAoB;CAC9C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import boilerplateFraming from "../../families/syntactic-patterns/lead-ins/boilerplate-framing.js";
|
|
2
|
+
import genericSignposting from "../../families/syntactic-patterns/lead-ins/generic-signposting.js";
|
|
3
|
+
import lessonFraming from "../../families/syntactic-patterns/lead-ins/lesson-framing.js";
|
|
4
|
+
import llmOpeners from "../../families/syntactic-patterns/lead-ins/llm-openers.js";
|
|
5
|
+
import observerGuidance from "../../families/syntactic-patterns/lead-ins/observer-guidance.js";
|
|
6
|
+
export const leadInRules = {
|
|
7
|
+
"boilerplate-framing": boilerplateFraming,
|
|
8
|
+
"generic-signposting": genericSignposting,
|
|
9
|
+
"lesson-framing": lessonFraming,
|
|
10
|
+
"llm-openers": llmOpeners,
|
|
11
|
+
"observer-guidance": observerGuidance
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=lead-ins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lead-ins.js","sourceRoot":"","sources":["../../../src/registries/syntactic-patterns/lead-ins.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,mEAAmE,CAAC;AACnG,OAAO,kBAAkB,MAAM,mEAAmE,CAAC;AACnG,OAAO,aAAa,MAAM,8DAA8D,CAAC;AACzF,OAAO,UAAU,MAAM,2DAA2D,CAAC;AACnF,OAAO,gBAAgB,MAAM,iEAAiE,CAAC;AAE/F,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,qBAAqB,EAAE,kBAAkB;IACzC,qBAAqB,EAAE,kBAAkB;IACzC,gBAAgB,EAAE,aAAa;IAC/B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE,gBAAgB;CACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-artifacts.js","sourceRoot":"","sources":["../../../src/registries/syntactic-patterns/llm-artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,qEAAqE,CAAC;AAElG,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,kBAAkB,EAAE,eAAe;CACpC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import demonstrativeEmphasis from "../../families/syntactic-patterns/repetition/demonstrative-emphasis.js";
|
|
2
|
+
import emptyEmphasis from "../../families/syntactic-patterns/repetition/empty-emphasis.js";
|
|
3
|
+
import fragmentStacking from "../../families/syntactic-patterns/repetition/fragment-stacking.js";
|
|
4
|
+
import tripleRepeat from "../../families/syntactic-patterns/repetition/triple-repeat.js";
|
|
5
|
+
export const repetitionRules = {
|
|
6
|
+
"demonstrative-emphasis": demonstrativeEmphasis,
|
|
7
|
+
"empty-emphasis": emptyEmphasis,
|
|
8
|
+
"fragment-stacking": fragmentStacking,
|
|
9
|
+
"triple-repeat": tripleRepeat
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=repetition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repetition.js","sourceRoot":"","sources":["../../../src/registries/syntactic-patterns/repetition.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,wEAAwE,CAAC;AAC3G,OAAO,aAAa,MAAM,gEAAgE,CAAC;AAC3F,OAAO,gBAAgB,MAAM,mEAAmE,CAAC;AACjG,OAAO,YAAY,MAAM,+DAA+D,CAAC;AAEzF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,wBAAwB,EAAE,qBAAqB;IAC/C,gBAAgB,EAAE,aAAa;IAC/B,mBAAmB,EAAE,gBAAgB;IACrC,eAAe,EAAE,YAAY;CAC9B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { authorityRules } from "./syntactic-patterns/authority.js";
|
|
2
|
+
import { closerRules } from "./syntactic-patterns/closers.js";
|
|
3
|
+
import { contrastRules } from "./syntactic-patterns/contrast.js";
|
|
4
|
+
import { generalizationRules } from "./syntactic-patterns/generalization.js";
|
|
5
|
+
import { leadInRules } from "./syntactic-patterns/lead-ins.js";
|
|
6
|
+
import { llmArtifactRules } from "./syntactic-patterns/llm-artifacts.js";
|
|
7
|
+
import { repetitionRules } from "./syntactic-patterns/repetition.js";
|
|
8
|
+
export const syntacticPatternRules = {
|
|
9
|
+
...authorityRules,
|
|
10
|
+
...closerRules,
|
|
11
|
+
...contrastRules,
|
|
12
|
+
...generalizationRules,
|
|
13
|
+
...leadInRules,
|
|
14
|
+
...llmArtifactRules,
|
|
15
|
+
...repetitionRules
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=syntactic-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntactic-patterns.js","sourceRoot":"","sources":["../../src/registries/syntactic-patterns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,GAAG,cAAc;IACjB,GAAG,WAAW;IACd,GAAG,aAAa;IAChB,GAAG,mBAAmB;IACtB,GAAG,WAAW;IACd,GAAG,gBAAgB;IACnB,GAAG,eAAe;CACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import recommendedTerms from "../families/term-policy/recommended-terms.js";
|
|
2
|
+
import requiredTerms from "../families/term-policy/required-terms.js";
|
|
3
|
+
export const termPolicyRules = {
|
|
4
|
+
"recommended-terms": recommendedTerms,
|
|
5
|
+
"required-terms": requiredTerms
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=term-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"term-policy.js","sourceRoot":"","sources":["../../src/registries/term-policy.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAC5E,OAAO,aAAa,MAAM,2CAA2C,CAAC;AAEtE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,mBAAmB,EAAE,gBAAgB;IACrC,gBAAgB,EAAE,aAAa;CAChC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import hedgeStacking from "../families/words/hedge-stacking.js";
|
|
2
|
+
import llmVocabulary from "../families/words/llm-vocabulary.js";
|
|
3
|
+
import prohibitedWords from "../families/words/prohibited-words.js";
|
|
4
|
+
import simplicity from "../families/words/simplicity.js";
|
|
5
|
+
export const wordRules = {
|
|
6
|
+
"hedge-stacking": hedgeStacking,
|
|
7
|
+
"llm-vocabulary": llmVocabulary,
|
|
8
|
+
"prohibited-words": prohibitedWords,
|
|
9
|
+
simplicity
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=words.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"words.js","sourceRoot":"","sources":["../../src/registries/words.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAChE,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAChE,OAAO,eAAe,MAAM,uCAAuC,CAAC;AACpE,OAAO,UAAU,MAAM,iCAAiC,CAAC;AAEzD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,gBAAgB,EAAE,aAAa;IAC/B,gBAAgB,EAAE,aAAa;IAC/B,kBAAkB,EAAE,eAAe;IACnC,UAAU;CACX,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { wordTokens } from "../text/tokens.js";
|
|
2
|
+
const DOUBLE_QUOTE_OPENERS = new Set(['"', "“"]);
|
|
3
|
+
const DOUBLE_QUOTE_CLOSERS = new Set(['"', "”"]);
|
|
4
|
+
function phraseTokens(phrase) {
|
|
5
|
+
return wordTokens(phrase).map((token) => token.normalized);
|
|
6
|
+
}
|
|
7
|
+
function tokensMatchAt(tokens, phrase, startIndex) {
|
|
8
|
+
if (startIndex + phrase.length > tokens.length) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
for (let offset = 0; offset < phrase.length; offset += 1) {
|
|
12
|
+
if (tokens[startIndex + offset]?.normalized !== phrase[offset]) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
export function findPhraseMatches(text, phrases) {
|
|
19
|
+
const tokens = wordTokens(text);
|
|
20
|
+
const matches = [];
|
|
21
|
+
for (const phrase of phrases) {
|
|
22
|
+
const normalizedPhrase = phraseTokens(phrase);
|
|
23
|
+
if (normalizedPhrase.length === 0) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
27
|
+
if (!tokensMatchAt(tokens, normalizedPhrase, index)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const first = tokens[index];
|
|
31
|
+
const last = tokens[index + normalizedPhrase.length - 1];
|
|
32
|
+
if (first === undefined || last === undefined) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
matches.push({
|
|
36
|
+
end: last.end,
|
|
37
|
+
phrase,
|
|
38
|
+
start: first.start,
|
|
39
|
+
text: text.slice(first.start, last.end)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return matches;
|
|
44
|
+
}
|
|
45
|
+
function findDoubleQuoteSpans(text) {
|
|
46
|
+
const spans = [];
|
|
47
|
+
let quoteStart;
|
|
48
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
49
|
+
const character = text[index];
|
|
50
|
+
if (character === undefined) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (quoteStart === undefined && DOUBLE_QUOTE_OPENERS.has(character)) {
|
|
54
|
+
quoteStart = index;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (quoteStart !== undefined && DOUBLE_QUOTE_CLOSERS.has(character)) {
|
|
58
|
+
spans.push({ end: index + 1, start: quoteStart });
|
|
59
|
+
quoteStart = undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return spans;
|
|
63
|
+
}
|
|
64
|
+
function isInsideSpan(match, spans) {
|
|
65
|
+
return spans.some((span) => match.start >= span.start && match.end <= span.end);
|
|
66
|
+
}
|
|
67
|
+
export function findUnquotedPhraseMatches(text, phrases) {
|
|
68
|
+
const quoteSpans = findDoubleQuoteSpans(text);
|
|
69
|
+
return findPhraseMatches(text, phrases).filter((match) => !isInsideSpan(match, quoteSpans));
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=phrases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phrases.js","sourceRoot":"","sources":["../../../src/shared/matchers/phrases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,mBAAmB,CAAC;AAc3D,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAA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