@yegor256/dogent 0.7.7 → 0.7.8

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/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "lint": "eslint .",
41
41
  "test": "mocha 'test/**/*.js' --timeout 60000"
42
42
  },
43
- "version": "0.7.7",
43
+ "version": "0.7.8",
44
44
  "dependencies": {
45
45
  "minimist": "^1.2.8"
46
46
  }
@@ -12,18 +12,20 @@ const Region = require('../region');
12
12
  * Atomic.
13
13
  *
14
14
  * Demands that every line carry exactly one instruction. A standalone
15
- * checker only spots the loud signs: a sentence terminator sitting
16
- * mid-line with more text after it, or two verb phrases welded together
17
- * with a semicolon, an " and ", or a " then ". The prompt hands the
18
- * subtler clause-counting to the AI oracle, which catches the
19
- * multi-instruction lines that carry no such welding token.
15
+ * checker spots only the unambiguous signs: a sentence terminator
16
+ * sitting mid-line with more text after it, or two clauses welded
17
+ * together by a semicolon. An " and " or " then " is left alone, since
18
+ * no suffix heuristic can tell a second verb from a coordinated object
19
+ * or temporal adverb without reading the word as language. The prompt
20
+ * hands that subtler clause-counting to the AI oracle, which weighs the
21
+ * full sentence before judging a line as multi-instruction.
20
22
  */
21
23
  class Atomic {
22
24
  constructor() {
23
25
  this.id = 'atomic';
24
26
  }
25
27
  prompt() {
26
- return `${this.id}: flag any line that carries more than one instruction, counting distinct clauses even when no semicolon, "and", or "then" welds them together`;
28
+ return `${this.id}: flag any line that carries more than one instruction, counting distinct clauses whether or not a semicolon, "and", or "then" welds them, yet never count a coordinated object or noun phrase trailing "and" or "then" as a second instruction`;
27
29
  }
28
30
  violations(document) {
29
31
  const uri = document.uri();
@@ -37,11 +39,7 @@ class Atomic {
37
39
  }
38
40
  judge(text, line, uri) {
39
41
  const clean = text.replace(/^\s*(?:[-*+]|\d+\.)\s+/u, '').trimEnd();
40
- const weld = /(?<!,)\s(?:and|then)\s+(?<verb>[a-z]+)\s+\S/u.exec(clean);
41
- const welded = weld !== null &&
42
- !/^(?:the|a|an)$/u.test(weld.groups.verb) &&
43
- !/(?:ly|al|ial|ous|ive|less|ic|ary|ory|able|ible|ate)$/u.test(weld.groups.verb);
44
- if (!/[.!?]\s+\S/u.test(clean) && !/;/u.test(clean) && !welded) {
42
+ if (!/[.!?]\s+\S/u.test(clean) && !/;/u.test(clean)) {
45
43
  return [];
46
44
  }
47
45
  return [new Violation(