@chaffjs/lang-en 0.31.0 → 0.33.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 (93) hide show
  1. package/dist/dates.d.ts.map +1 -1
  2. package/dist/dates.js +35 -3
  3. package/dist/dates.js.map +1 -1
  4. package/dist/definitions.d.ts.map +1 -1
  5. package/dist/definitions.js +18 -6
  6. package/dist/definitions.js.map +1 -1
  7. package/dist/emphasis.d.ts +8 -0
  8. package/dist/emphasis.d.ts.map +1 -1
  9. package/dist/emphasis.js +18 -0
  10. package/dist/emphasis.js.map +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +14 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/list-line.d.ts +12 -0
  16. package/dist/list-line.d.ts.map +1 -0
  17. package/dist/list-line.js +118 -0
  18. package/dist/list-line.js.map +1 -0
  19. package/dist/pos.d.ts.map +1 -1
  20. package/dist/pos.js +6 -3
  21. package/dist/pos.js.map +1 -1
  22. package/lexicons/advice-opener.yaml +12 -0
  23. package/lexicons/any-year-marker.yaml +27 -2
  24. package/lexicons/article-sound.yaml +3 -0
  25. package/lexicons/attached-instrument-label.yaml +12 -0
  26. package/lexicons/breakdown-partial-word.yaml +8 -0
  27. package/lexicons/capacity-marker.yaml +7 -0
  28. package/lexicons/capital-phrase.yaml +7 -0
  29. package/lexicons/caps-convention.yaml +8 -2
  30. package/lexicons/carrier-name.yaml +11 -0
  31. package/lexicons/citation-series.yaml +11 -0
  32. package/lexicons/common-acronym.yaml +7 -0
  33. package/lexicons/comparative-baseline.yaml +5 -0
  34. package/lexicons/concrete-deadline.yaml +1 -0
  35. package/lexicons/contraction.yaml +4 -3
  36. package/lexicons/count-title.yaml +10 -0
  37. package/lexicons/date-stamp-label.yaml +1 -0
  38. package/lexicons/dated-pair-label.yaml +8 -0
  39. package/lexicons/dated-pair-version-word.yaml +7 -0
  40. package/lexicons/defined-elsewhere.yaml +12 -0
  41. package/lexicons/defined-term-pointer.yaml +26 -0
  42. package/lexicons/definition-alternative.yaml +6 -0
  43. package/lexicons/demonstrative-not-opener.yaml +3 -0
  44. package/lexicons/duration-per-period.yaml +18 -0
  45. package/lexicons/extra-word.yaml +37 -1
  46. package/lexicons/figure-scale-joiner.yaml +6 -0
  47. package/lexicons/figure-scale-word.yaml +9 -0
  48. package/lexicons/instruction-verb.yaml +1 -0
  49. package/lexicons/known-misspelling.yaml +8 -0
  50. package/lexicons/legal-form.yaml +28 -0
  51. package/lexicons/list-note-lead.yaml +9 -0
  52. package/lexicons/literal-quote-cue.yaml +16 -0
  53. package/lexicons/memo-header-label.yaml +16 -0
  54. package/lexicons/mention-cue.yaml +15 -0
  55. package/lexicons/name-determiner.yaml +25 -0
  56. package/lexicons/name-prefix.yaml +7 -0
  57. package/lexicons/name-title-joiner.yaml +3 -1
  58. package/lexicons/named-deadline.yaml +12 -0
  59. package/lexicons/negation-word.yaml +13 -0
  60. package/lexicons/page-marker.yaml +8 -0
  61. package/lexicons/placeholder-word.yaml +17 -0
  62. package/lexicons/proper-name-word.yaml +10 -2
  63. package/lexicons/reference-label.yaml +19 -0
  64. package/lexicons/reference-list-joint.yaml +16 -0
  65. package/lexicons/request-condition.yaml +3 -0
  66. package/lexicons/request-contact.yaml +11 -0
  67. package/lexicons/request-deadline.yaml +2 -0
  68. package/lexicons/request-invitation.yaml +10 -0
  69. package/lexicons/request-timing.yaml +11 -0
  70. package/lexicons/requirement-loophole.yaml +3 -0
  71. package/lexicons/requirement-open-condition.yaml +9 -0
  72. package/lexicons/requirement-open-question.yaml +6 -0
  73. package/lexicons/rounded-amount-unit.yaml +9 -0
  74. package/lexicons/section-name-noun.yaml +10 -0
  75. package/lexicons/self-prefix.yaml +6 -0
  76. package/lexicons/sequence-opener.yaml +17 -0
  77. package/lexicons/side-step-label.yaml +7 -0
  78. package/lexicons/street-suffix.yaml +16 -0
  79. package/lexicons/tax-code.yaml +7 -0
  80. package/lexicons/term-mention-cue.yaml +15 -0
  81. package/lexicons/timed-pair-label.yaml +8 -0
  82. package/lexicons/title-cue.yaml +9 -0
  83. package/lexicons/unnumbered-heading.yaml +13 -0
  84. package/lexicons/vague-word-term-of-art.yaml +21 -0
  85. package/lexicons/verb-or-adjective.yaml +14 -0
  86. package/lexicons/wordy-phrase.yaml +3 -3
  87. package/package.json +1 -1
  88. package/src/dates.ts +39 -3
  89. package/src/definitions.ts +17 -6
  90. package/src/emphasis.ts +22 -0
  91. package/src/index.ts +16 -3
  92. package/src/list-line.ts +136 -0
  93. package/src/pos.ts +6 -3
@@ -0,0 +1,15 @@
1
+ # Words that name a phrase as a term rather than use it: when saying "raise the bar", the phrase "low-hanging fruit".
2
+ # group before: right before the phrase (quote marks may stand between). Written forms only: "say" would also take
3
+ # "I'd say the bottom line is", which uses the phrase.
4
+ id: mention-cue
5
+ language: en
6
+ entries:
7
+ - { pattern: saying, group: before }
8
+ - { pattern: the phrase, group: before }
9
+ - { pattern: the term, group: before }
10
+ - { pattern: the expression, group: before }
11
+ - { pattern: the idiom, group: before }
12
+ - { pattern: the cliché, group: before }
13
+ - { pattern: the cliche, group: before }
14
+ - { pattern: the words, group: before }
15
+ - { pattern: so-called, group: before }
@@ -0,0 +1,25 @@
1
+ # Words that open a noun phrase (the, this, each, our). Capitalised at the start of a sentence (The SE team), they are still
2
+ # not part of a company's name, so a legal form right after one is read as an acronym. Matched without regard to case.
3
+ id: name-determiner
4
+ language: en
5
+ entries:
6
+ - pattern: "the"
7
+ - pattern: "a"
8
+ - pattern: "an"
9
+ - pattern: "this"
10
+ - pattern: "that"
11
+ - pattern: "these"
12
+ - pattern: "those"
13
+ - pattern: "each"
14
+ - pattern: "every"
15
+ - pattern: "any"
16
+ - pattern: "no"
17
+ - pattern: "some"
18
+ - pattern: "all"
19
+ - pattern: "our"
20
+ - pattern: "your"
21
+ - pattern: "their"
22
+ - pattern: "its"
23
+ - pattern: "his"
24
+ - pattern: "her"
25
+ - pattern: "my"
@@ -0,0 +1,7 @@
1
+ # Words written before a capitalised word to make a name (HM Revenue & Customs, HM Treasury, HMS Victory). Matched as written.
2
+ id: name-prefix
3
+ language: en
4
+ entries:
5
+ - pattern: "HM"
6
+ - pattern: "HMS"
7
+ - pattern: "HRH"
@@ -1,9 +1,11 @@
1
1
  # Small words inside a Title Case name ("Foundations of Statistics", "Bank of the West"). name-variant reads capitalised
2
2
  # words across them as one name when it compares names written with the same words in another order. "and", "to" and
3
- # "with" are left out: across them stand two names ("Texas and Florida"), not one.
3
+ # "with" are left out: across them stand two names ("Texas and Florida"), not one. An article (group: article) joins only
4
+ # right after another small word ("of the"): alone it starts a new phrase ("this Agreement the Stockholders").
4
5
  id: name-title-joiner
5
6
  language: en
6
7
  entries:
7
8
  - pattern: of
8
9
  - pattern: for
9
10
  - pattern: the
11
+ group: article
@@ -0,0 +1,12 @@
1
+ # Names of a dated deadline (the Due Date, the Payment Date) and the act whose time each sets (group: a timed-duty word). A
2
+ # duty to do that act in the same article (else the same list or paragraph) as its deadline's name is timed by that date, and
3
+ # obligation-without-deadline leaves it: "The Customer shall pay the Fees." beside "Fees not paid by the Due Date bear
4
+ # interest." A date for another act (a delivery date beside a duty to pay) times nothing.
5
+ id: named-deadline
6
+ language: en
7
+ entries:
8
+ - { pattern: due date, group: pay }
9
+ - { pattern: payment date, group: pay }
10
+ - { pattern: payment due date, group: pay }
11
+ - { pattern: delivery date, group: deliver }
12
+ - { pattern: return date, group: return }
@@ -0,0 +1,13 @@
1
+ # Negating words. modal-conflict reads them: a negation inside the act or its condition ("goods that do not conform")
2
+ # is part of what a sentence decides, so two sentences that differ only by it decide different things.
3
+ # Matched by the written form or the lemma, lower-cased. "n't" is the contracted not.
4
+ id: negation-word
5
+ language: en
6
+ entries:
7
+ - pattern: not
8
+ - pattern: n't
9
+ - pattern: no
10
+ - pattern: never
11
+ - pattern: neither
12
+ - pattern: nor
13
+ - pattern: without
@@ -0,0 +1,8 @@
1
+ # Page markers a converted print edition leaves inside a sentence: the Federal Register's web edition
2
+ # ("remediation ( printed page 52044) workflows") and the GPO text edition ("[[Page 52044]]"). max-sentence-length does
3
+ # not count them. "#" stands for the page number, and a space for any run of spaces, none included.
4
+ id: page-marker
5
+ language: en
6
+ entries:
7
+ - pattern: "( printed page #)"
8
+ - pattern: "[[Page #]]"
@@ -25,3 +25,20 @@ entries:
25
25
  group: marker
26
26
  - pattern: FIXME
27
27
  group: marker
28
+ # group: label — a template's instruction label left in a filled document ("OPTIONAL: General conclusions (bullet
29
+ # points or narrative)"). It counts only written in capitals exactly as here, opening a line before a colon and some
30
+ # text: "Optional: bring a jacket" is a note to the reader, not a template's instruction.
31
+ - pattern: OPTIONAL
32
+ group: label
33
+ # group: template — a word that, in a heading, says the section is a template ("## Template", "# Sample letter").
34
+ # Blanks under that heading (to the next heading at its depth or above) are what the template is for, so they are not reported.
35
+ - pattern: template
36
+ group: template
37
+ - pattern: templates
38
+ group: template
39
+ - pattern: sample letter
40
+ group: template
41
+ - pattern: model letter
42
+ group: template
43
+ - pattern: model form
44
+ group: template
@@ -1,6 +1,7 @@
1
1
  # Words that make a capitalised run a name, not a term the document defines: of a law or a document (the Federal Trade
2
- # Commission Act, Acceptable Use Policies, the GitHub Privacy Statement), of a body (the Department of Commerce), of a place
3
- # (the State of New York), of the parties (the Parties, the Indemnifying Party), and words English capitalises by convention (the Internet). undefined-term leaves every run that
2
+ # Commission Act, Acceptable Use Policies, the GitHub Privacy Statement), of a body (the Department of Commerce, the World
3
+ # Health Organization), of a place (the State of New York), of the parties (the Parties, the Indemnifying Party), of an office
4
+ # (the Chief Executive Officer, the President), and words English capitalises by convention (the Internet, the Web, acts of God). undefined-term leaves every run that
4
5
  # holds one of these, in its singular or plural form, as it leaves places (place-region), weekdays and months, company
5
6
  # forms and party roles. Matched as written, word by word.
6
7
  id: proper-name-word
@@ -43,6 +44,8 @@ entries:
43
44
  - pattern: Foundation
44
45
  - pattern: Association
45
46
  - pattern: Institute
47
+ - pattern: Organization
48
+ - pattern: Organisation
46
49
  - pattern: University
47
50
  - pattern: List
48
51
  - pattern: State
@@ -52,4 +55,9 @@ entries:
52
55
  - pattern: Republic
53
56
  - pattern: Kingdom
54
57
  - pattern: Internet
58
+ - pattern: Web
59
+ - pattern: God
60
+ - pattern: Officer
61
+ - pattern: President
62
+ - pattern: Director
55
63
  - pattern: Party
@@ -156,3 +156,22 @@ entries:
156
156
  - { pattern: member no, group: member }
157
157
  - { pattern: customer number, group: customer }
158
158
  - { pattern: customer number is, group: customer }
159
+ # An incident's number. A postmortem and a support ticket may be numbered apart from the incident, so each is a group of its own.
160
+ # A bare "incident" is not a label (an incident in March); a code with no label is still compared with the one labelled code it swaps to.
161
+ - { pattern: incident number, group: incident }
162
+ - { pattern: incident number is, group: incident }
163
+ - { pattern: incident no., group: incident }
164
+ - { pattern: incident no, group: incident }
165
+ - { pattern: incident id, group: incident }
166
+ - { pattern: incident id is, group: incident }
167
+ - { pattern: postmortem id, group: postmortem }
168
+ - { pattern: postmortem id is, group: postmortem }
169
+ - { pattern: postmortem number, group: postmortem }
170
+ - { pattern: postmortem number is, group: postmortem }
171
+ - { pattern: ticket, group: ticket }
172
+ - { pattern: ticket number, group: ticket }
173
+ - { pattern: ticket number is, group: ticket }
174
+ - { pattern: ticket no., group: ticket }
175
+ - { pattern: ticket no, group: ticket }
176
+ - { pattern: ticket id, group: ticket }
177
+ - { pattern: ticket id is, group: ticket }
@@ -0,0 +1,16 @@
1
+ # Words and marks that, alone between two references, make them one list or range (reference-title-mismatch): "sections 9
2
+ # to 11 (stay of legal proceedings)". A name in brackets after such a list names the group, not the last section. A bare
3
+ # comma is not one: "Subject to section 5, section 7 (Pricing) applies" names section 7 alone; a list ends in "and" or "or".
4
+ # Japanese has no such list: in 第三条、第三十九条(第七項を除く。) the bracket binds to the article right before it.
5
+ id: reference-list-joint
6
+ language: en
7
+ entries:
8
+ - pattern: "and"
9
+ - pattern: "or"
10
+ - pattern: ", and"
11
+ - pattern: ", or"
12
+ - pattern: "and/or"
13
+ - pattern: "to"
14
+ - pattern: "through"
15
+ - pattern: "-"
16
+ - pattern: –
@@ -13,3 +13,6 @@ entries:
13
13
  - pattern: as needed
14
14
  - pattern: where needed
15
15
  - pattern: if needed
16
+ - pattern: those who wish
17
+ - pattern: anyone who wishes
18
+ - pattern: anyone interested
@@ -0,0 +1,11 @@
1
+ # Labels of a contact line ("Phone:", "Fax:"), counted only when a colon follows. A request in the same sentence as that line
2
+ # says how to reach the writer.
3
+ id: request-contact
4
+ language: en
5
+ entries:
6
+ - pattern: phone
7
+ - pattern: tel
8
+ - pattern: telephone
9
+ - pattern: fax
10
+ - pattern: email
11
+ - pattern: e-mail
@@ -65,3 +65,5 @@ entries:
65
65
  - pattern: dec
66
66
  - pattern: immediately
67
67
  - pattern: urgently
68
+ - pattern: any time
69
+ - pattern: anytime
@@ -0,0 +1,10 @@
1
+ # Invitation verbs. Right at the request ("please come", "please join us"), coming is the reader's choice: nothing is to be finished.
2
+ id: request-invitation
3
+ language: en
4
+ entries:
5
+ - pattern: come
6
+ - pattern: join us
7
+ - pattern: visit
8
+ - pattern: drop by
9
+ - pattern: stop by
10
+ - pattern: consult
@@ -0,0 +1,11 @@
1
+ # Words in the request that say when relative to something else ("after you submit", "in advance"). The date is not
2
+ # given, but when to act is. Counted only in the request itself: the next sentence's "after that" is about something else.
3
+ id: request-timing
4
+ language: en
5
+ entries:
6
+ - pattern: after you
7
+ - pattern: once you
8
+ - pattern: in advance
9
+ - pattern: beforehand
10
+ - pattern: at the time of
11
+ - pattern: upon receipt
@@ -5,7 +5,10 @@ language: en
5
5
  entries:
6
6
  - pattern: as far as possible
7
7
  - pattern: as much as possible
8
+ # group: time is a loophole about when. A number of days in the same sentence (concrete-deadline) bounds it:
9
+ # "as soon as possible, but in any event no later than two Business Days after".
8
10
  - pattern: as soon as possible
11
+ group: time
9
12
  - pattern: as fast as possible
10
13
  - pattern: to the extent possible
11
14
  - pattern: if possible
@@ -0,0 +1,9 @@
1
+ # Words that state a condition. An open list in brackets right after one ("in other cases (a single-table query, etc.)")
2
+ # gives examples of when the requirement applies, not what it covers. Read by requirement-smell.
3
+ id: requirement-open-condition
4
+ language: en
5
+ entries:
6
+ - pattern: case
7
+ - pattern: cases
8
+ - pattern: when
9
+ - pattern: where
@@ -0,0 +1,6 @@
1
+ # Words of a question that an open list gives example answers to (〜措置など、どのような措置を求めるのか in Japanese). English
2
+ # puts such a list after its question ("state which measures you seek, such as …"), where "such as" is no open-end word,
3
+ # so there are none; the list exists so both languages name the same lists.
4
+ id: requirement-open-question
5
+ language: en
6
+ entries: []
@@ -0,0 +1,9 @@
1
+ # Units of amounts written rounded to a digit ($6,655 million, $3.1 billion). When a total in a sentence and all its items
2
+ # are in one of these, total-mismatch reads a difference of up to (number of items − 1) last digits as rounding.
3
+ id: rounded-amount-unit
4
+ language: en
5
+ entries:
6
+ - pattern: thousand
7
+ - pattern: million
8
+ - pattern: billion
9
+ - pattern: trillion
@@ -0,0 +1,10 @@
1
+ # Nouns that turn "section N" into the name of a thing defined by another Act: "a section 21 notice", "a section 8 form".
2
+ # dangling-reference reads every "section 21" in a document that writes "section 21 notice" as that Act's section, not
3
+ # one of its own. Only the lower-case "section" counts: a contract's "Section 5 notice" points into the contract.
4
+ id: section-name-noun
5
+ language: en
6
+ entries:
7
+ - pattern: notice
8
+ - pattern: notices
9
+ - pattern: form
10
+ - pattern: forms
@@ -0,0 +1,6 @@
1
+ # The word in front of a name that points at this document itself ("this Agreement", "this Policy"). A term the document
2
+ # defines as its own name (this "Agreement") may be written with it before the definition (use-before-definition).
3
+ id: self-prefix
4
+ language: en
5
+ entries:
6
+ - pattern: this
@@ -0,0 +1,17 @@
1
+ # One word that opens a sentence by giving its place in a sequence (First, …; Finally, …). Followed by a comma it is an
2
+ # introduction, not the first item of a list, though the tagger may read First as an adjective. Read by oxford-comma-consistency.
3
+ id: sequence-opener
4
+ language: en
5
+ entries:
6
+ - pattern: first
7
+ - pattern: firstly
8
+ - pattern: second
9
+ - pattern: secondly
10
+ - pattern: third
11
+ - pattern: thirdly
12
+ - pattern: fourth
13
+ - pattern: next
14
+ - pattern: then
15
+ - pattern: last
16
+ - pattern: lastly
17
+ - pattern: finally
@@ -0,0 +1,7 @@
1
+ # Words a step-by-step list writes in place of a step's number, for a step done alongside the one before it
2
+ # ("1 Check the rules", "and Book a courier", "3 Pack the parcel"). Such a step may have taken a number.
3
+ id: side-step-label
4
+ language: en
5
+ entries:
6
+ - pattern: and
7
+ - pattern: or
@@ -0,0 +1,16 @@
1
+ # Street types written short and in capitals after a street number and name (512 Bayshore DR). Read only there. Matched as written.
2
+ id: street-suffix
3
+ language: en
4
+ entries:
5
+ - pattern: "DR"
6
+ - pattern: "ST"
7
+ - pattern: "AVE"
8
+ - pattern: "BLVD"
9
+ - pattern: "RD"
10
+ - pattern: "LN"
11
+ - pattern: "CT"
12
+ - pattern: "PKWY"
13
+ - pattern: "HWY"
14
+ - pattern: "PL"
15
+ - pattern: "SQ"
16
+ - pattern: "TER"
@@ -0,0 +1,7 @@
1
+ # Names of taxes a reader knows by their short form (VAT, GST). Like common acronyms, they are not asked to be spelled out.
2
+ # Matched as written.
3
+ id: tax-code
4
+ language: en
5
+ entries:
6
+ - pattern: "VAT"
7
+ - pattern: "GST"
@@ -0,0 +1,15 @@
1
+ # Words right before an opening quote that name the quoted words as a term: the definition of "Material Adverse Effect",
2
+ # the term "Affiliate". The term is mentioned there, not used, so defined-term-form does not report it as quoted again.
3
+ # Matched without regard to case.
4
+ id: term-mention-cue
5
+ language: en
6
+ entries:
7
+ - pattern: definition of
8
+ - pattern: definitions of
9
+ - pattern: meaning of
10
+ - pattern: the term
11
+ - pattern: the terms
12
+ - pattern: the word
13
+ - pattern: the words
14
+ - pattern: the phrase
15
+ - pattern: defined term
@@ -52,3 +52,11 @@ entries:
52
52
  - { pattern: "Finish", group: span, position: after }
53
53
  - { pattern: "Finishes", group: span, position: after }
54
54
  - { pattern: "Expected finish", group: span, position: after }
55
+ # An incident report: the incident starts, then it is detected. "Resolved" is left out: an incident can clear before anyone notices.
56
+ - { pattern: "Started", group: incident, position: before }
57
+ - { pattern: "Start time", group: incident, position: before }
58
+ - { pattern: "Began", group: incident, position: before }
59
+ - { pattern: "Incident start", group: incident, position: before }
60
+ - { pattern: "Detected", group: incident, position: after }
61
+ - { pattern: "Detection time", group: incident, position: after }
62
+ - { pattern: "Time detected", group: incident, position: after }
@@ -0,0 +1,9 @@
1
+ # Words that introduce a cited title written without quotes ("whose full title is Protecting Tokens and Assertions from
2
+ # Forgery, Theft, and Misuse"). The run of Title Case words right after one is the title, and its commas are the title
3
+ # author's, so oxford-comma-consistency does not count them as the writer's choice.
4
+ id: title-cue
5
+ language: en
6
+ entries:
7
+ - pattern: title is
8
+ - pattern: titled
9
+ - pattern: entitled
@@ -25,3 +25,16 @@ entries:
25
25
  - pattern: Foreword
26
26
  - pattern: Changelog
27
27
  - pattern: Revision History
28
+ # The contact block at the end of a press release or a notice.
29
+ - pattern: Contact
30
+ - pattern: Contacts
31
+ - pattern: Media contact
32
+ - pattern: Media contacts
33
+ - pattern: Press contact
34
+ - pattern: Press contacts
35
+ # The standard closing sections of an HMRC notice, after its numbered parts.
36
+ - pattern: Your rights and obligations
37
+ - pattern: Help us improve this notice
38
+ - pattern: Putting things right
39
+ - pattern: How we use your information
40
+ - pattern: How HMRC uses your information
@@ -0,0 +1,21 @@
1
+ # Terms of art that hold a vague word. In the genres listed, law and practice give them a meaning ("reasonable" is the
2
+ # standard a court applies, "best efforts" a known degree of effort, "from time to time" means as amended), so
3
+ # vague-word-density does not count a vague word inside one there. Elsewhere the same words are counted.
4
+ id: vague-word-term-of-art
5
+ language: en
6
+ entries:
7
+ - pattern: reasonable
8
+ genres: [legal]
9
+ - pattern: reasonably
10
+ genres: [legal]
11
+ - pattern: best efforts
12
+ genres: [legal]
13
+ - pattern: best effort
14
+ genres: [legal]
15
+ - pattern: from time to time
16
+ genres: [legal]
17
+ # The test for injunctive relief: damages that cannot adequately compensate the harm.
18
+ - pattern: adequately compensate
19
+ genres: [legal]
20
+ - pattern: adequate remedy
21
+ genres: [legal]
@@ -0,0 +1,14 @@
1
+ # Words that open an instruction (Secure the server, Open the app) and also an adjective before a noun (Secure
2
+ # configuration, Open questions). list-item-form-mix reads a list item opening with one as opening with a verb only when
3
+ # "the", "a" or a possessive follows; otherwise it does not judge the item's first word. Matched in lower case.
4
+ id: verb-or-adjective
5
+ language: en
6
+ entries:
7
+ - pattern: secure
8
+ - pattern: open
9
+ - pattern: clean
10
+ - pattern: clear
11
+ - pattern: close
12
+ - pattern: complete
13
+ - pattern: empty
14
+ - pattern: free
@@ -1,6 +1,8 @@
1
1
  # Wordy phrases: several words where one or two say the same. Read by wordy-phrase; rewrite is the short form.
2
2
  # Only phrases whose short form says the same in every context. "with regard to", "prior to" and "in accordance with"
3
- # are left out: contracts and statutes use them on purpose. Matched as whole words, case aside.
3
+ # are left out: contracts and statutes use them on purpose. "a small number of" is left out too: "a few" names a
4
+ # different count, and minutes use both as separate points of one scale (a few, a small number, some, several, many).
5
+ # Matched as whole words, case aside.
4
6
  id: wordy-phrase
5
7
  language: en
6
8
  entries:
@@ -60,8 +62,6 @@ entries:
60
62
  rewrite: except
61
63
  - pattern: in the majority of cases
62
64
  rewrite: usually
63
- - pattern: a small number of
64
- rewrite: a few
65
65
  - pattern: at an early date
66
66
  rewrite: soon
67
67
  - pattern: by means of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaffjs/lang-en",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "English language adapter for chaff",
5
5
  "license": "MIT",
6
6
  "author": "isamu",
package/src/dates.ts CHANGED
@@ -13,6 +13,33 @@ const ISO_DATE = /\b(?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2})\b/gu;
13
13
  const DAY_BEFORE = /(?<d>\d{1,2})(?:st|nd|rd|th)? $/u;
14
14
  const DAY_YEAR_AFTER = /^ (?<d>\d{1,2})(?:st|nd|rd|th)?,? (?<y>\d{4})\b/u;
15
15
  const YEAR_AFTER = /^,? (?<y>\d{4})\b/u;
16
+ /** "Mar 28 14:02:11 UTC 2024", the form of `date` and C's ctime: the year comes after the time and its zone. */
17
+ const DAY_TIME_YEAR_AFTER = /^ (?<d>\d{1,2}) (?:[01]?\d|2[0-3]):[0-5]\d(?::[0-5]\d)?(?: (?!AM\b|PM\b)[A-Z]{2,5})? (?<y>\d{4})\b/u;
18
+ const TIME_YEAR_REACH = 32;
19
+ /** A time zone or "hrs" after four figures: "1300 UTC", "0930 PST", "1300 hrs". */
20
+ const ZONE_WORDS: ReadonlySet<string> = new Set(
21
+ ["UTC", "GMT", "Z", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT", "BST", "IST", "JST", "KST"].concat([
22
+ "CET",
23
+ "CEST",
24
+ "EET",
25
+ "EEST",
26
+ "AEST",
27
+ "AEDT",
28
+ "hrs",
29
+ "hours",
30
+ ]),
31
+ );
32
+ /** The word after the figures, unless it runs on into "&" ("AT&T"). */
33
+ const WORD_AFTER = /^ ?(?<word>[A-Za-z]+)(?![\w&])/u;
34
+ const zoneAfter = (rest: string): boolean => ZONE_WORDS.has(WORD_AFTER.exec(rest)?.groups?.["word"] ?? "");
35
+ const HOURS_IN_DAY = 24;
36
+ const MINUTES_IN_HOUR = 60;
37
+ /** From here on, four figures before a zone may be a year as well as a time ("March 28 2024 UTC"), and stay a year. */
38
+ const MODERN_YEARS_FROM = 1900;
39
+
40
+ /** "Mar 28 1300 UTC": four figures that can only be a 24-hour clock, with a time zone after them, are the time, not the year. */
41
+ const clockTime = (figures: string, rest: string): boolean =>
42
+ Number(figures) < MODERN_YEARS_FROM && Number(figures.slice(0, 2)) < HOURS_IN_DAY && Number(figures.slice(2)) < MINUTES_IN_HOUR && zoneAfter(rest);
16
43
 
17
44
  const pad = (value: string): string => value.padStart(2, "0");
18
45
 
@@ -26,16 +53,25 @@ const dayBefore = (text: string, at: number): { readonly day: string; readonly s
26
53
  /** "April 1, 2024" → 2024-04-01. */
27
54
  const monthDayYear = (text: string, at: number, end: number, month: number): Mention | undefined => {
28
55
  const found = DAY_YEAR_AFTER.exec(text.slice(end, end + 16));
29
- if (found?.groups === undefined) return undefined;
56
+ if (found?.groups === undefined || clockTime(found.groups["y"] ?? "", text.slice(end + found[0].length))) return undefined;
30
57
  const value = `${found.groups["y"] ?? ""}-${pad(String(month))}-${pad(found.groups["d"] ?? "")}`;
31
58
  return { start: at, end: end + found[0].length, attrs: { value } };
32
59
  };
33
60
 
61
+ /** "Mar 28 14:02:11 UTC 2024" → 2024-03-28. The mention ends at the day, so the time stays a time of its own. */
62
+ const monthDayTimeYear = (text: string, at: number, end: number, month: number): Mention | undefined => {
63
+ const found = DAY_TIME_YEAR_AFTER.exec(text.slice(end, end + TIME_YEAR_REACH));
64
+ const day = found?.groups?.["d"];
65
+ if (found?.groups === undefined || day === undefined) return undefined;
66
+ const value = `${found.groups["y"] ?? ""}-${pad(String(month))}-${pad(day)}`;
67
+ return { start: at, end: end + 1 + day.length, attrs: { value } };
68
+ };
69
+
34
70
  /** "1 April 2024" → 2024-04-01, "April 2024" → 2024-04. */
35
71
  const monthYear = (text: string, at: number, end: number, month: number): Mention | undefined => {
36
72
  const found = YEAR_AFTER.exec(text.slice(end, end + 8));
37
73
  const year = found?.groups?.["y"];
38
- if (found === null || year === undefined) return undefined;
74
+ if (found === null || year === undefined || clockTime(year, text.slice(end + found[0].length))) return undefined;
39
75
  const before = dayBefore(text, at);
40
76
  const value = [year, pad(String(month)), ...(before === undefined ? [] : [pad(before.day)])].join("-");
41
77
  return { start: before?.start ?? at, end: end + found[0].length, attrs: { value } };
@@ -104,7 +140,7 @@ const namedDate = (text: string, match: RegExpExecArray): Mention | undefined =>
104
140
  const month = full === 0 ? (ABBREVIATED.get(word) ?? 0) : full;
105
141
  if (month === 0) return undefined;
106
142
  const end = match.index + match[0].length + (full === 0 && text.charAt(match.index + match[0].length) === "." ? 1 : 0);
107
- const dated = monthDayYear(text, match.index, end, month) ?? monthYear(text, match.index, end, month);
143
+ const dated = monthDayYear(text, match.index, end, month) ?? monthYear(text, match.index, end, month) ?? monthDayTimeYear(text, match.index, end, month);
108
144
  return dated ?? (ALL_CAPS.test(match[0]) ? undefined : monthDay(text, match.index, end, month));
109
145
  };
110
146
 
@@ -6,8 +6,8 @@ import { readsAsExample } from "./example-name.ts";
6
6
 
7
7
  const DEFINITIONS = [
8
8
  /["“](?<term>[^"”\n]{1,60})["”] (?:means|shall mean|refers to|has the meaning)\b/gu,
9
- /\((?:the |these |this |hereinafter |each,? an? |collectively,? the )?["“](?<term>[^"”\n]{1,60})["”]\)/gu,
10
- /\(hereinafter referred to as ["“](?<term>[^"”\n]{1,60})["”]\)/gu,
9
+ /\((?:the |these |this |each,? an? |collectively,? the )?["“](?<term>[^"”\n]{1,60})["”]\)/gu,
10
+ /\(hereinafter (?:referred to as |called )?(?:the )?["“](?<term>[^"”\n]{1,60})["”]\)/gu,
11
11
  ];
12
12
 
13
13
  /**
@@ -42,15 +42,24 @@ const BARE = /^\(["“]/u;
42
42
  const BRACKET = /\((?<inside>[^()\n]{1,300})\)/gu;
43
43
  const QUOTED_NAME = /["“](?<term>[^"”\n]{1,60})["”]/gu;
44
44
  /** What may come before the first name: (the "Company", (each, a "Party", (collectively, the "Parties". */
45
- const LIST_LEAD = /^(?:the |collectively,? the |each,? an? )?$/u;
45
+ const LIST_LEAD = /^(?:the |hereinafter (?:the )?|collectively,? the |each,? an? )?$/u;
46
46
  /** What may come between two names: a comma, and or or, and the. */
47
47
  const LIST_JOINT = /^(?:, (?:and |or )?| and | or )(?:the )?$/u;
48
48
  /** A list of names starts with a capitalised one ("Pinecone"); ("mine", "not mine", "yours") quotes examples. */
49
49
  const CAPITALISED = /^\p{Lu}/u;
50
50
 
51
+ /**
52
+ * After a party's name, the name of all the parties: (the "Company" and, together with Parent, the "Parties"). The first
53
+ * name is the party's; the rest must end on a capitalised quoted name, so a bracket that trails off is not read.
54
+ */
55
+ const TOGETHER_WITH = /^[,;]? and,? (?:together|collectively) with /u;
56
+
51
57
  type QuotedName = { readonly term: string; readonly start: number; readonly end: number };
52
58
 
53
- /** The quoted names of a bracket that holds nothing but two or more names, joined as a list; otherwise none. */
59
+ /**
60
+ * The quoted names of a bracket that holds nothing but two or more names joined as a list, or a name followed by the
61
+ * name of all the parties; otherwise none.
62
+ */
54
63
  const namesInList = (inside: string): QuotedName[] => {
55
64
  const names = [...inside.matchAll(QUOTED_NAME)].map((match) => ({
56
65
  term: match.groups?.["term"] ?? "",
@@ -58,9 +67,11 @@ const namesInList = (inside: string): QuotedName[] => {
58
67
  end: match.index + match[0].length,
59
68
  }));
60
69
  const [first] = names;
61
- if (first === undefined || names.length < 2 || !CAPITALISED.test(first.term) || !LIST_LEAD.test(inside.slice(0, first.start))) return [];
70
+ if (first === undefined || !CAPITALISED.test(first.term) || !LIST_LEAD.test(inside.slice(0, first.start))) return [];
71
+ if (names.length < 2 || inside.slice(names.at(-1)?.end ?? 0) !== "") return [];
72
+ if (TOGETHER_WITH.test(inside.slice(first.end))) return names.every((name) => CAPITALISED.test(name.term)) ? names : [];
62
73
  const joined = names.slice(1).every((name, index) => LIST_JOINT.test(inside.slice(names[index]?.end ?? 0, name.start)));
63
- return joined && inside.slice(names.at(-1)?.end ?? 0) === "" ? names : [];
74
+ return joined ? names : [];
64
75
  };
65
76
 
66
77
  /**