@chaffjs/lang-en 0.35.0 → 0.37.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.
Files changed (73) hide show
  1. package/dist/citation.d.ts.map +1 -1
  2. package/dist/citation.js +8 -2
  3. package/dist/citation.js.map +1 -1
  4. package/dist/names-read-as-verbs.d.ts +21 -0
  5. package/dist/names-read-as-verbs.d.ts.map +1 -0
  6. package/dist/names-read-as-verbs.js +40 -0
  7. package/dist/names-read-as-verbs.js.map +1 -0
  8. package/dist/pos.d.ts.map +1 -1
  9. package/dist/pos.js +30 -1
  10. package/dist/pos.js.map +1 -1
  11. package/dist/structure.d.ts.map +1 -1
  12. package/dist/structure.js +13 -0
  13. package/dist/structure.js.map +1 -1
  14. package/lexicons/ai-tell.yaml +55 -27
  15. package/lexicons/announcing-opener.yaml +7 -0
  16. package/lexicons/article-sound.yaml +1 -0
  17. package/lexicons/citation-series.yaml +1 -0
  18. package/lexicons/clause-conjunction.yaml +7 -0
  19. package/lexicons/closing-cliche.yaml +11 -0
  20. package/lexicons/closing-exhortation.yaml +11 -0
  21. package/lexicons/cold-open.yaml +30 -0
  22. package/lexicons/common-acronym.yaml +15 -0
  23. package/lexicons/comparative-baseline.yaml +14 -0
  24. package/lexicons/condition-heading.yaml +21 -0
  25. package/lexicons/connective-opener.yaml +23 -0
  26. package/lexicons/contraction-head.yaml +10 -0
  27. package/lexicons/contrast-amount.yaml +13 -0
  28. package/lexicons/contrast-lead.yaml +38 -0
  29. package/lexicons/contrast-turn.yaml +5 -0
  30. package/lexicons/drug-stem.yaml +48 -0
  31. package/lexicons/elision-mark.yaml +9 -0
  32. package/lexicons/email-closing.yaml +7 -1
  33. package/lexicons/email-salutation-end.yaml +7 -0
  34. package/lexicons/email-stock-courtesy.yaml +29 -0
  35. package/lexicons/everyday-name.yaml +24 -0
  36. package/lexicons/extra-word.yaml +15 -1
  37. package/lexicons/honesty-marker.yaml +14 -0
  38. package/lexicons/honorific.yaml +3 -0
  39. package/lexicons/indefinite-article.yaml +8 -0
  40. package/lexicons/intent-phrase.yaml +21 -0
  41. package/lexicons/interviewer-mark.yaml +10 -0
  42. package/lexicons/list-continues.yaml +9 -0
  43. package/lexicons/name-capitals-prefix.yaml +16 -0
  44. package/lexicons/name-direction-word.yaml +10 -0
  45. package/lexicons/name-title-head.yaml +23 -0
  46. package/lexicons/name-word-ending.yaml +10 -0
  47. package/lexicons/navigation-line.yaml +11 -0
  48. package/lexicons/open-list-end.yaml +10 -0
  49. package/lexicons/option-choice-label.yaml +8 -0
  50. package/lexicons/over-general-claim.yaml +57 -6
  51. package/lexicons/padded-intro.yaml +14 -0
  52. package/lexicons/product-name.yaml +9 -0
  53. package/lexicons/prohibition-opener.yaml +6 -0
  54. package/lexicons/quote-not-attribution.yaml +13 -0
  55. package/lexicons/request-deadline-section.yaml +1 -0
  56. package/lexicons/sql-keyword.yaml +28 -0
  57. package/lexicons/superlative-goal.yaml +40 -0
  58. package/lexicons/superlative-part.yaml +22 -0
  59. package/lexicons/superlative-phrase.yaml +8 -0
  60. package/lexicons/superlative-purpose.yaml +7 -0
  61. package/lexicons/superlative-referent.yaml +15 -0
  62. package/lexicons/superlative-scope.yaml +5 -1
  63. package/lexicons/template-heading.yaml +35 -0
  64. package/lexicons/text-message-verb.yaml +11 -0
  65. package/lexicons/uninflected-word.yaml +22 -0
  66. package/lexicons/unprompted-denial.yaml +113 -0
  67. package/lexicons/verbatim-lead.yaml +11 -0
  68. package/lexicons/word-suffix.yaml +29 -1
  69. package/package.json +1 -1
  70. package/src/citation.ts +9 -2
  71. package/src/names-read-as-verbs.ts +65 -0
  72. package/src/pos.ts +33 -1
  73. package/src/structure.ts +14 -0
@@ -1,11 +1,62 @@
1
1
  # Sweeping claims about people in general: what most people do, what nobody does. Read by over-general-claim, which
2
2
  # counts them per length of the document; one is ordinary. "Most people agree" and "everyone knows" are weasel-word's.
3
+ #
4
+ # general: names people at large, always counted.
5
+ # subject: counted only as the subject of a verb (many people keep ...), not as a count of people (see many people).
6
+ # who: counted unless the text says which people it means (bounded): a group named in the same or the previous
7
+ # sentence (group-noun, addressee), a word right after it (right-after: everyone here), or a past-tense verb
8
+ # right after it, which reports what one group did once (nobody caught it, everyone who jumped in).
9
+ # present-form: the present forms of be, have and do; the past-tense check reads them as present.
10
+ # relative: the pronoun the past-tense check steps over (everyone who jumped in).
3
11
  id: over-general-claim
4
12
  language: en
5
13
  entries:
6
- - pattern: most people
7
- - pattern: for most of us
8
- - pattern: for most households
9
- - pattern: nobody
10
- - pattern: everyone
11
- - pattern: anyone who
14
+ - { pattern: most people, group: general }
15
+ - { pattern: most of us, group: general }
16
+ - { pattern: for most households, group: general }
17
+ - { pattern: many people, group: subject }
18
+ - { pattern: nobody, group: who }
19
+ - { pattern: everyone, group: who }
20
+ - { pattern: anyone who, group: who }
21
+
22
+ - { pattern: team, group: group-noun }
23
+ - { pattern: teams, group: group-noun }
24
+ - { pattern: family, group: group-noun }
25
+ - { pattern: families, group: group-noun }
26
+ - { pattern: household, group: group-noun }
27
+ - { pattern: members, group: group-noun }
28
+ - { pattern: staff, group: group-noun }
29
+ - { pattern: colleagues, group: group-noun }
30
+ - { pattern: coworkers, group: group-noun }
31
+ - { pattern: co-workers, group: group-noun }
32
+ - { pattern: employees, group: group-noun }
33
+ - { pattern: crew, group: group-noun }
34
+ - { pattern: class, group: group-noun }
35
+ - { pattern: committee, group: group-noun }
36
+ - { pattern: department, group: group-noun }
37
+ - { pattern: office, group: group-noun }
38
+ - { pattern: guests, group: group-noun }
39
+ - { pattern: attendees, group: group-noun }
40
+ - { pattern: participants, group: group-noun }
41
+ - { pattern: call, group: group-noun }
42
+ - { pattern: meeting, group: group-noun }
43
+ - { pattern: room, group: group-noun }
44
+
45
+ - { pattern: all of you, group: addressee }
46
+ - { pattern: you all, group: addressee }
47
+
48
+ - { pattern: here, group: right-after }
49
+ - { pattern: present, group: right-after }
50
+
51
+ - { pattern: is, group: present-form }
52
+ - { pattern: are, group: present-form }
53
+ - { pattern: am, group: present-form }
54
+ - { pattern: has, group: present-form }
55
+ - { pattern: does, group: present-form }
56
+ - { pattern: "'s", group: present-form }
57
+ - { pattern: "'re", group: present-form }
58
+ - { pattern: "'m", group: present-form }
59
+ - { pattern: "'ve", group: present-form }
60
+
61
+ - { pattern: who, group: relative }
62
+ - { pattern: that, group: relative }
@@ -6,3 +6,17 @@ entries:
6
6
  - pattern: has gained significant attention
7
7
  - pattern: is becoming increasingly important
8
8
  - pattern: have you ever wondered
9
+ # A problem every team or company could name, used as the way in.
10
+ - pattern: many teams struggle
11
+ - pattern: many organizations struggle
12
+ - pattern: many organisations struggle
13
+ - pattern: many companies struggle
14
+ - pattern: many businesses struggle
15
+ - pattern: as organizations increasingly
16
+ - pattern: as organisations increasingly
17
+ - pattern: as businesses increasingly
18
+ - pattern: as companies increasingly
19
+ - pattern: in today's digital
20
+ - pattern: in today's world
21
+ - pattern: in an ever-changing
22
+ - pattern: it's no secret
@@ -0,0 +1,9 @@
1
+ # Product names that end in capitals (Adobe Acrobat Reader DC). The capitals are the edition's name inside the product's,
2
+ # not an acronym the writer spells out. Only the whole name is matched, as written: DC alone stays an acronym.
3
+ id: product-name
4
+ language: en
5
+ entries:
6
+ - pattern: Acrobat Reader DC
7
+ - pattern: Acrobat Pro DC
8
+ - pattern: Acrobat Standard DC
9
+ - pattern: Acrobat DC
@@ -0,0 +1,6 @@
1
+ # Words that open a prohibition before a noun (No calls, No food in the lab). list-item-form-mix reads a list item opening
2
+ # with one as neither a verb nor a noun phrase: it is a rule, as "Never feed animals" is. Matched in lower case.
3
+ id: prohibition-opener
4
+ language: en
5
+ entries:
6
+ - pattern: "no"
@@ -0,0 +1,13 @@
1
+ # Shapes in which a word of quote-attribution does not give the quoted words to someone. quote-without-source reads it.
2
+ # example a word before the quotation, in the same sentence, that opens an example (For instance, a user says "…").
3
+ # The writer made the words up to illustrate.
4
+ # thing a word right before the cue that makes its subject a thing (a sign that said "…", a note which read "…"):
5
+ # the words are written on it, and there is nobody to cite.
6
+ id: quote-not-attribution
7
+ language: en
8
+ entries:
9
+ - { pattern: for example, group: example }
10
+ - { pattern: for instance, group: example }
11
+ - { pattern: e.g., group: example }
12
+ - { pattern: that, group: thing }
13
+ - { pattern: which, group: thing }
@@ -9,3 +9,4 @@ entries:
9
9
  - pattern: important dates
10
10
  - pattern: deadline
11
11
  - pattern: deadlines
12
+ - pattern: decision deadline
@@ -0,0 +1,28 @@
1
+ # Keywords of SQL (ISO/IEC 9075) written in capitals in the prose of a database document (a VIEW, the WHERE clause). They are
2
+ # words, not abbreviations, so there is nothing to expand. DELETE is in http-method. Matched as written.
3
+ id: sql-keyword
4
+ language: en
5
+ entries:
6
+ - pattern: SELECT
7
+ - pattern: INSERT
8
+ - pattern: UPDATE
9
+ - pattern: MERGE
10
+ - pattern: CREATE
11
+ - pattern: ALTER
12
+ - pattern: DROP
13
+ - pattern: TRUNCATE
14
+ - pattern: VIEW
15
+ - pattern: TABLE
16
+ - pattern: INDEX
17
+ - pattern: JOIN
18
+ - pattern: WHERE
19
+ - pattern: FROM
20
+ - pattern: UNION
21
+ - pattern: HAVING
22
+ - pattern: COMMIT
23
+ - pattern: ROLLBACK
24
+ - pattern: GRANT
25
+ - pattern: REVOKE
26
+ - pattern: SCHEMA
27
+ - pattern: CURSOR
28
+ - pattern: TRIGGER
@@ -0,0 +1,40 @@
1
+ # Verbs that take a superlative as what is sought or chosen, not as what is claimed: "to achieve the best results",
2
+ # "before deciding the best way", "identify which font was the most legible", "start with the most important tasks". They stand before the superlative, at most
3
+ # a few words away in the same clause. unqualified-superlative does not report a superlative they govern.
4
+ id: superlative-goal
5
+ language: en
6
+ entries:
7
+ - pattern: achieve
8
+ position: before
9
+ - pattern: attain
10
+ position: before
11
+ - pattern: reach
12
+ position: before
13
+ - pattern: come to
14
+ position: before
15
+ - pattern: arrive at
16
+ position: before
17
+ - pattern: aim for
18
+ position: before
19
+ - pattern: strive for
20
+ position: before
21
+ - pattern: decide
22
+ position: before
23
+ - pattern: determine
24
+ position: before
25
+ - pattern: choose
26
+ position: before
27
+ - pattern: select
28
+ position: before
29
+ - pattern: pick
30
+ position: before
31
+ - pattern: identify
32
+ position: before
33
+ - pattern: start with
34
+ position: before
35
+ - pattern: begin with
36
+ position: before
37
+ - pattern: prioritize
38
+ position: before
39
+ - pattern: prioritise
40
+ position: before
@@ -0,0 +1,22 @@
1
+ # Nouns that name a part of something the text describes. A superlative whose noun is one of them ranks the parts of that
2
+ # whole ("the most important part of the formula", "the customer is the most important role" in a workshop), not the
3
+ # world: the set is the whole's parts. English only: the noun follows the superlative's modifiers.
4
+ id: superlative-part
5
+ language: en
6
+ entries:
7
+ - pattern: part
8
+ - pattern: parts
9
+ - pattern: role
10
+ - pattern: roles
11
+ - pattern: step
12
+ - pattern: steps
13
+ - pattern: aspect
14
+ - pattern: aspects
15
+ - pattern: element
16
+ - pattern: elements
17
+ - pattern: component
18
+ - pattern: components
19
+ - pattern: stage
20
+ - pattern: stages
21
+ - pattern: phase
22
+ - pattern: phases
@@ -1,5 +1,7 @@
1
1
  # Set phrases that hold a superlative but claim nothing is the best. A superlative inside one is not reported by
2
2
  # unqualified-superlative. "Even the best" concedes ("even the best teams slip"); "the best case" is a hypothetical.
3
+ # "Make the most of" and "do the most good" are idioms of effort; "the most recent" places in time; "the most common"
4
+ # reports how often something occurs; "the most important thing" orders the writer's own points.
3
5
  id: superlative-phrase
4
6
  language: en
5
7
  entries:
@@ -11,3 +13,9 @@ entries:
11
13
  - pattern: even with the best
12
14
  - pattern: the best case
13
15
  - pattern: the best-case
16
+ - pattern: make the most of
17
+ - pattern: get the most out of
18
+ - pattern: do the most good
19
+ - pattern: the most recent
20
+ - pattern: the most common
21
+ - pattern: the most important thing
@@ -0,0 +1,7 @@
1
+ # Words after a superlative's noun that name its set only when a gerund follows: "the most important tool for creating
2
+ # the culture" (tools for creating it), "the most prominent intervention for combating misinformation". "For" with a
3
+ # noun ("the best opportunity for government") names who gains, not a set.
4
+ id: superlative-purpose
5
+ language: en
6
+ entries:
7
+ - pattern: for
@@ -0,0 +1,15 @@
1
+ # Words that point at one member of a set, after a superlative subject and its verb: "The best plan is the one you will
2
+ # keep", "The most important divergence is the second". The sentence says which one is the most, not that something is.
3
+ id: superlative-referent
4
+ language: en
5
+ entries:
6
+ - pattern: one
7
+ - pattern: ones
8
+ - pattern: first
9
+ - pattern: second
10
+ - pattern: third
11
+ - pattern: last
12
+ - pattern: former
13
+ - pattern: latter
14
+ - pattern: whichever
15
+ - pattern: whatever
@@ -1,6 +1,6 @@
1
1
  # Words that say what a superlative is the most of. position is the side of the superlative they stand on.
2
2
  # English puts them after the superlative's noun phrase, with a noun phrase after them: "the best pizza in Chicago",
3
- # "the most famous of the sculptures".
3
+ # "the most famous of the sculptures", "the best thing about this gathering", "the best models at the frontier".
4
4
  id: superlative-scope
5
5
  language: en
6
6
  entries:
@@ -8,3 +8,7 @@ entries:
8
8
  position: after
9
9
  - pattern: of
10
10
  position: after
11
+ - pattern: about
12
+ position: after
13
+ - pattern: at
14
+ position: after
@@ -0,0 +1,35 @@
1
+ # The sections of a textbook proposal or report outline. A heading counts for its group when it starts with the pattern
2
+ # (case ignored). One or two are ordinary in a real proposal; ai-structure counts the outline when four groups appear.
3
+ id: template-heading
4
+ language: en
5
+ entries:
6
+ - { pattern: executive summary, group: summary }
7
+ - { pattern: summary, group: summary }
8
+ - { pattern: overview, group: summary }
9
+ - { pattern: background, group: background }
10
+ - { pattern: current situation, group: background }
11
+ - { pattern: current state, group: background }
12
+ - { pattern: problem statement, group: background }
13
+ - { pattern: the problem, group: background }
14
+ - { pattern: proposed solution, group: proposal }
15
+ - { pattern: proposal, group: proposal }
16
+ - { pattern: our proposal, group: proposal }
17
+ - { pattern: recommendation, group: proposal }
18
+ - { pattern: recommendations, group: proposal }
19
+ - { pattern: expected benefits, group: benefits }
20
+ - { pattern: benefits, group: benefits }
21
+ - { pattern: expected outcomes, group: benefits }
22
+ - { pattern: expected impact, group: benefits }
23
+ - { pattern: costs, group: costs }
24
+ - { pattern: cost, group: costs }
25
+ - { pattern: budget, group: costs }
26
+ - { pattern: implementation, group: implementation }
27
+ - { pattern: implementation plan, group: implementation }
28
+ - { pattern: timeline, group: implementation }
29
+ - { pattern: rollout, group: implementation }
30
+ - { pattern: risks, group: risks }
31
+ - { pattern: risk, group: risks }
32
+ - { pattern: risks and mitigation, group: risks }
33
+ - { pattern: next steps, group: next }
34
+ - { pattern: conclusion, group: next }
35
+ - { pattern: conclusions, group: next }
@@ -0,0 +1,11 @@
1
+ # Verbs that send a keyword by text message (text GNPCGS to 333111). The capitals between the verb and the short code are
2
+ # a keyword to type as it stands, not an acronym to spell out. Matched as written, in any case.
3
+ id: text-message-verb
4
+ language: en
5
+ entries:
6
+ - pattern: text
7
+ - pattern: texts
8
+ - pattern: texting
9
+ - pattern: txt
10
+ - pattern: reply
11
+ - pattern: replying
@@ -0,0 +1,22 @@
1
+ # Function words that take no ending (word-suffix): a determiner, a pronoun or a conjunction never has a plural or a
2
+ # past. unknown-word does not read "thoses" as "those" + s, so the slip is reported. Only closed-class words are listed;
3
+ # a word that does take an ending in some use (a noun, a verb) never belongs here.
4
+ id: uninflected-word
5
+ language: en
6
+ entries:
7
+ - pattern: although
8
+ - pattern: because
9
+ - pattern: these
10
+ - pattern: those
11
+ - pattern: their
12
+ - pattern: there
13
+ - pattern: thus
14
+ - pattern: unless
15
+ - pattern: where
16
+ - pattern: whether
17
+ - pattern: which
18
+ - pattern: whom
19
+ - pattern: whose
20
+ - pattern: would
21
+ - pattern: could
22
+ - pattern: should
@@ -0,0 +1,113 @@
1
+ # A sentence that denies a premise nobody stated ("This isn't about tooling.", "That's not the point."). Groups as
2
+ # unprompted-denial.ts reads them:
3
+ # open the sentence opens with it, and the next word is a follow word: a denial of what something is
4
+ # follow the word after open ("about", "a", "the", "what"); "It's not ready." negates a fact and is not counted
5
+ # basis a reason in the same sentence: the denial states a fact
6
+ # premise in the previous sentence: the denial answers something the text said ("You might think ...")
7
+ id: unprompted-denial
8
+ language: en
9
+ entries:
10
+ - pattern: this isn't
11
+ group: open
12
+ - pattern: this is not
13
+ group: open
14
+ - pattern: that's not
15
+ group: open
16
+ - pattern: that is not
17
+ group: open
18
+ - pattern: that isn't
19
+ group: open
20
+ - pattern: it's not
21
+ group: open
22
+ - pattern: it is not
23
+ group: open
24
+ - pattern: it isn't
25
+ group: open
26
+ - pattern: these aren't
27
+ group: open
28
+ - pattern: these are not
29
+ group: open
30
+ - pattern: those aren't
31
+ group: open
32
+ - pattern: those are not
33
+ group: open
34
+ - pattern: the point isn't
35
+ group: open
36
+ - pattern: the point is not
37
+ group: open
38
+ - pattern: the goal isn't
39
+ group: open
40
+ - pattern: the goal is not
41
+ group: open
42
+ - pattern: the problem isn't
43
+ group: open
44
+ - pattern: the problem is not
45
+ group: open
46
+ - pattern: the question isn't
47
+ group: open
48
+ - pattern: the question is not
49
+ group: open
50
+ - pattern: the answer isn't
51
+ group: open
52
+ - pattern: the answer is not
53
+ group: open
54
+ - pattern: about
55
+ group: follow
56
+ - pattern: a
57
+ group: follow
58
+ - pattern: an
59
+ group: follow
60
+ - pattern: the
61
+ group: follow
62
+ - pattern: just
63
+ group: follow
64
+ - pattern: only
65
+ group: follow
66
+ - pattern: what
67
+ group: follow
68
+ - pattern: why
69
+ group: follow
70
+ - pattern: how
71
+ group: follow
72
+ - pattern: where
73
+ group: follow
74
+ - pattern: who
75
+ group: follow
76
+ - pattern: my
77
+ group: follow
78
+ - pattern: your
79
+ group: follow
80
+ - pattern: our
81
+ group: follow
82
+ - pattern: their
83
+ group: follow
84
+ - pattern: something
85
+ group: follow
86
+ - pattern: really
87
+ group: follow
88
+ - pattern: simply
89
+ group: follow
90
+ - pattern: merely
91
+ group: follow
92
+ - pattern: because
93
+ group: basis
94
+ - pattern: since
95
+ group: basis
96
+ - pattern: due to
97
+ group: basis
98
+ - pattern: you might think
99
+ group: premise
100
+ - pattern: you may think
101
+ group: premise
102
+ - pattern: people think
103
+ group: premise
104
+ - pattern: some say
105
+ group: premise
106
+ - pattern: it's tempting
107
+ group: premise
108
+ - pattern: assume
109
+ group: premise
110
+ - pattern: myth
111
+ group: premise
112
+ - pattern: misconception
113
+ group: premise
@@ -0,0 +1,11 @@
1
+ # Words of a lead-in that says the next paragraph is another document's text, word for word ("The entire receipt reads
2
+ # as follows:"). A lead-in ends with a colon; max-sentence-length does not measure the paragraph after it. Matched
3
+ # case-insensitively anywhere in the lead-in.
4
+ id: verbatim-lead
5
+ language: en
6
+ entries:
7
+ - pattern: reads as follows
8
+ - pattern: read as follows
9
+ - pattern: reads in full
10
+ - pattern: reads in part
11
+ - pattern: reads in pertinent part
@@ -1,45 +1,64 @@
1
1
  # Endings that make an inflected or derived form of a dictionary word: unknown-word strips the ending (pattern) and
2
2
  # puts the replacement (instead_of, empty when nothing goes back) before looking the stem up. "carried" is "carry",
3
3
  # "stopped" is "stop" (a doubled last consonant is undone too), "baking" is "bake". The dictionary itself is
4
- # dictionary.txt; this list only saves listing every inflected form there.
4
+ # dictionary.txt; this list only saves listing every inflected form there. An ending of group inflection (a plural, a
5
+ # past, a comparative) closes a word: unknown-word takes it on top of a derived word ("operationalises" is
6
+ # "operationalise" + s), never a derived ending on top of it, and never two of them ("oversers" is not "overs" + ers).
5
7
  id: word-suffix
6
8
  language: en
7
9
  entries:
8
10
  - pattern: s
9
11
  instead_of: ""
12
+ group: inflection
10
13
  - pattern: es
11
14
  instead_of: ""
15
+ group: inflection
12
16
  - pattern: ies
13
17
  instead_of: "y"
18
+ group: inflection
14
19
  # The Greek plural: "pneumoconioses" is "pneumoconiosis".
15
20
  - pattern: ses
16
21
  instead_of: "sis"
22
+ group: inflection
17
23
  - pattern: ied
18
24
  instead_of: "y"
25
+ group: inflection
19
26
  - pattern: ed
20
27
  instead_of: ""
28
+ group: inflection
21
29
  - pattern: ed
22
30
  instead_of: "e"
31
+ group: inflection
23
32
  - pattern: ing
24
33
  instead_of: ""
34
+ group: inflection
25
35
  - pattern: ing
26
36
  instead_of: "e"
37
+ group: inflection
27
38
  - pattern: er
28
39
  instead_of: ""
40
+ group: inflection
29
41
  - pattern: er
30
42
  instead_of: "e"
43
+ group: inflection
31
44
  - pattern: ers
32
45
  instead_of: ""
46
+ group: inflection
33
47
  - pattern: ers
34
48
  instead_of: "e"
49
+ group: inflection
35
50
  - pattern: ier
36
51
  instead_of: "y"
52
+ group: inflection
37
53
  - pattern: iest
38
54
  instead_of: "y"
55
+ group: inflection
39
56
  - pattern: est
40
57
  instead_of: ""
58
+ group: inflection
41
59
  - pattern: est
42
60
  instead_of: "e"
61
+ group: inflection
43
62
  # The adjective of a noun: "crunchy" is "crunch", "possessory" is "possessor", "stony" is "stone".
44
63
  - pattern: y
45
64
  instead_of: ""
@@ -87,3 +106,12 @@ entries:
87
106
  instead_of: "ible"
88
107
  - pattern: men
89
108
  instead_of: "man"
109
+ group: inflection
110
+ # The follower of a doctrine and the doctrine: "relativist" is "relativism", "generalism" is "generalist".
111
+ - pattern: ist
112
+ instead_of: "ism"
113
+ - pattern: ism
114
+ instead_of: "ist"
115
+ # The adjective of an -ion noun: "propositional" is "proposition".
116
+ - pattern: ional
117
+ instead_of: "ion"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaffjs/lang-en",
3
- "version": "0.35.0",
3
+ "version": "0.37.0",
4
4
  "description": "English language adapter for chaff",
5
5
  "license": "MIT",
6
6
  "author": "isamu",
package/src/citation.ts CHANGED
@@ -100,14 +100,21 @@ const titleWords = (rest: string): string[] => {
100
100
  /** Labels the reference did not take into its address: the "(E)" of "section 552(a)(6)(E) of title 5". */
101
101
  const UNREAD_LABELS = /^(?:\([A-Za-z0-9]{1,4}\))+/u;
102
102
 
103
+ /**
104
+ * "chapter 15 (§401 et seq.) of Title 50": the sections from this one on, glossing the unit before the bracket, which the
105
+ * name after the bracket governs.
106
+ */
107
+ const RUN_ON = /^ et seq\.\)?/u;
108
+
103
109
  /** What follows the "of" after a reference and its list, or undefined when no "of" follows. */
104
110
  const afterOf = (text: string, end: number): string | undefined => {
105
111
  const rest = text.slice(end, end + 200);
106
112
  const unread = UNREAD_LABELS.exec(rest)?.[0].length ?? 0;
107
113
  const afterList = unread + listEnd(rest.slice(unread));
108
114
  const afterGloss = afterList + (GLOSS.exec(rest.slice(afterList))?.[0].length ?? 0);
109
- const of = OF.exec(rest.slice(afterGloss));
110
- return of === null ? undefined : rest.slice(afterGloss + of[0].length);
115
+ const afterRun = afterGloss + (RUN_ON.exec(rest.slice(afterGloss))?.[0].length ?? 0);
116
+ const of = OF.exec(rest.slice(afterRun));
117
+ return of === null ? undefined : rest.slice(afterRun + of[0].length);
111
118
  };
112
119
 
113
120
  /**
@@ -0,0 +1,65 @@
1
+ // A name the tagger reads as a verb or a pronoun because its lower-case spelling is one: AI as the "ai" of ain't, CA as the
2
+ // "ca" of can't, the US as "us", the IS department as "is". The tagger's vocabulary is keyed by the lower-case word, so it
3
+ // cannot tell the two apart; the sentence can.
4
+
5
+ type TaggedWord = { readonly value: string; readonly pos: string; readonly lemma?: string };
6
+
7
+ const CAPITALS = /^\p{Lu}{2,}$/u;
8
+
9
+ /** Penn tags a name is never given: the verb forms, the modal and the personal pronoun. */
10
+ const VERB_OR_PRONOUN = /^(?:VB[DGNPZ]?|MD|PRP)$/u;
11
+
12
+ /** The second half of a negative contraction, as the tagger splits it off (ca|n't). */
13
+ const NEGATION = "n't";
14
+
15
+ export type NameReadings = {
16
+ /** The first halves of a negative contraction, lower case (ai, ca, wo, sha). */
17
+ readonly contractionHeads: ReadonlySet<string>;
18
+ /** Whether a word opens a noun phrase that a verb or a pronoun cannot follow: an article or a possessive. */
19
+ readonly opensNounPhrase: (word: TaggedWord) => boolean;
20
+ };
21
+
22
+ /** A contraction's first half with no n't after it is not the contraction (AI is changing, lives in CA). */
23
+ const isUnpairedContractionHead = (tagged: readonly TaggedWord[], at: number, heads: ReadonlySet<string>): boolean =>
24
+ heads.has((tagged[at]?.value ?? "").toLowerCase()) && tagged[at + 1]?.value.toLowerCase() !== NEGATION;
25
+
26
+ /**
27
+ * Capitals right after an article or a possessive (the US office, our IT team, the company's IS staff) stand where a noun
28
+ * stands. Capitals elsewhere stay as the tagger read them: "I AM here", "it IS done" and "a hurricane DID form" are emphasis,
29
+ * and "That IS correct" opens with a demonstrative, not an article.
30
+ */
31
+ const isCapitalsAfterOpener = (tagged: readonly TaggedWord[], at: number, opensNounPhrase: NameReadings["opensNounPhrase"]): boolean => {
32
+ const previous = tagged[at - 1];
33
+ return CAPITALS.test(tagged[at]?.value ?? "") && previous !== undefined && opensNounPhrase(previous);
34
+ };
35
+
36
+ /** The positions of words the tagger read as a verb or a pronoun that the sentence shows to be names. */
37
+ export const namesReadAsVerbs = (tagged: readonly TaggedWord[], readings: NameReadings): readonly number[] =>
38
+ tagged.flatMap((word, at) =>
39
+ VERB_OR_PRONOUN.test(word.pos) &&
40
+ (isUnpairedContractionHead(tagged, at, readings.contractionHeads) || isCapitalsAfterOpener(tagged, at, readings.opensNounPhrase))
41
+ ? [at]
42
+ : [],
43
+ );
44
+
45
+ const asName = (word: TaggedWord): TaggedWord => ({ value: word.value, pos: "NNP", lemma: word.value.toLowerCase() });
46
+
47
+ /**
48
+ * The sentence read again with each name at `positions` replaced by `placeholder`, a word the tagger does not know: the names
49
+ * become proper nouns, and their neighbours take the tagger's reading of a sentence with a name there (the US team: team is a
50
+ * noun, not a verb after "us"). When the two readings do not line up word for word, only the names change.
51
+ */
52
+ export const rereadAsNames = (
53
+ entries: readonly TaggedWord[],
54
+ again: readonly TaggedWord[],
55
+ positions: readonly number[],
56
+ placeholder: string,
57
+ ): readonly TaggedWord[] => {
58
+ const names = new Set(positions);
59
+ const aligned = again.length === entries.length && again.every((word, at) => word.value === (names.has(at) ? placeholder : entries[at]?.value));
60
+ const source = aligned ? again : entries;
61
+ return source.map((word, at) => {
62
+ const original = entries[at] ?? word;
63
+ return names.has(at) ? asName(original) : { ...word, value: original.value };
64
+ });
65
+ };