@chaffjs/lang-en 0.32.0 → 0.34.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 (57) 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/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +14 -3
  7. package/dist/index.js.map +1 -1
  8. package/dist/list-line.d.ts +12 -0
  9. package/dist/list-line.d.ts.map +1 -0
  10. package/dist/list-line.js +118 -0
  11. package/dist/list-line.js.map +1 -0
  12. package/lexicons/abbreviation-mention.yaml +14 -0
  13. package/lexicons/any-year-marker.yaml +6 -1
  14. package/lexicons/article-sound.yaml +3 -0
  15. package/lexicons/attached-document-cue.yaml +33 -0
  16. package/lexicons/attached-instrument-label.yaml +12 -0
  17. package/lexicons/breakdown-partial-word.yaml +8 -0
  18. package/lexicons/caps-convention.yaml +8 -2
  19. package/lexicons/citation-signal.yaml +8 -0
  20. package/lexicons/common-acronym.yaml +9 -0
  21. package/lexicons/comparative-baseline.yaml +5 -0
  22. package/lexicons/concrete-deadline.yaml +7 -0
  23. package/lexicons/count-title.yaml +10 -0
  24. package/lexicons/date-stamp-label.yaml +1 -0
  25. package/lexicons/defined-term-pointer.yaml +26 -0
  26. package/lexicons/definition-alternative.yaml +6 -0
  27. package/lexicons/demonstrative-not-opener.yaml +3 -0
  28. package/lexicons/duration-per-period.yaml +18 -0
  29. package/lexicons/email-greeting.yaml +1 -0
  30. package/lexicons/extra-word.yaml +54 -1
  31. package/lexicons/figure-scale-joiner.yaml +6 -0
  32. package/lexicons/figure-scale-word.yaml +9 -0
  33. package/lexicons/instruction-verb.yaml +1 -0
  34. package/lexicons/known-misspelling.yaml +8 -0
  35. package/lexicons/list-note-lead.yaml +9 -0
  36. package/lexicons/literal-quote-cue.yaml +16 -0
  37. package/lexicons/memo-header-label.yaml +16 -0
  38. package/lexicons/mention-cue.yaml +15 -0
  39. package/lexicons/named-deadline.yaml +12 -0
  40. package/lexicons/negation-word.yaml +13 -0
  41. package/lexicons/placeholder-word.yaml +5 -0
  42. package/lexicons/requirement-open-condition.yaml +9 -0
  43. package/lexicons/requirement-open-end.yaml +3 -0
  44. package/lexicons/requirement-open-question.yaml +6 -0
  45. package/lexicons/rounded-amount-unit.yaml +9 -0
  46. package/lexicons/self-prefix.yaml +6 -0
  47. package/lexicons/sequence-opener.yaml +17 -0
  48. package/lexicons/side-step-label.yaml +7 -0
  49. package/lexicons/term-mention-cue.yaml +15 -0
  50. package/lexicons/title-cue.yaml +9 -0
  51. package/lexicons/verb-or-adjective.yaml +14 -0
  52. package/lexicons/wordy-phrase.yaml +3 -3
  53. package/lexicons/year-span-joiner.yaml +5 -1
  54. package/package.json +1 -1
  55. package/src/dates.ts +39 -3
  56. package/src/index.ts +16 -3
  57. package/src/list-line.ts +136 -0
@@ -0,0 +1,18 @@
1
+ # Words that make a count of days or weeks a count in each period (duration-mismatch): "3 days a week" is how many days every
2
+ # week, not a length to add to a date. after: written after the count; group: the period's unit. Only a count in a smaller
3
+ # unit than its period is one ("1 year every year" is a length).
4
+ id: duration-per-period
5
+ language: en
6
+ entries:
7
+ - { pattern: a week, group: week, position: after }
8
+ - { pattern: per week, group: week, position: after }
9
+ - { pattern: each week, group: week, position: after }
10
+ - { pattern: every week, group: week, position: after }
11
+ - { pattern: a month, group: month, position: after }
12
+ - { pattern: per month, group: month, position: after }
13
+ - { pattern: each month, group: month, position: after }
14
+ - { pattern: every month, group: month, position: after }
15
+ - { pattern: a year, group: year, position: after }
16
+ - { pattern: per year, group: year, position: after }
17
+ - { pattern: each year, group: year, position: after }
18
+ - { pattern: every year, group: year, position: after }
@@ -11,6 +11,7 @@ entries:
11
11
  - pattern: Good afternoon
12
12
  - pattern: Good evening
13
13
  - pattern: Greetings
14
+ - pattern: Welcome
14
15
  - pattern: To whom it may concern
15
16
  - pattern: Ladies and gentlemen
16
17
  - pattern: Sir
@@ -1,17 +1,22 @@
1
1
  # Words in everyday technical and business writing that WordNet does not list. unknown-word reads them as known, with
2
2
  # their endings: function words WordNet leaves out (cannot, wherein, albeit, whilst), Latin phrases in English text
3
- # (a priori, in forma pauperis) and newer coinages (onboard, roadmap, phishing). A team adds its own words under names in chaff.yaml; this list is only for words any document may use.
3
+ # (a priori, in forma pauperis, de minimis), the legal words of contracts (thereunder, herefrom, monies, pendency,
4
+ # cedent, telecopy) and newer coinages (onboard, roadmap, phishing, vishing, ransomware). A team adds its own words
5
+ # under names in chaff.yaml; this list is only for words any document may use.
4
6
  id: extra-word
5
7
  language: en
6
8
  entries:
7
9
  - pattern: accessibility
8
10
  - pattern: admin
11
+ - pattern: adware
9
12
  - pattern: albeit
10
13
  - pattern: alia
11
14
  - pattern: api
12
15
  - pattern: app
16
+ - pattern: aridification
13
17
  - pattern: async
14
18
  - pattern: auth
19
+ - pattern: awardee
15
20
  - pattern: backend
16
21
  - pattern: backlog
17
22
  - pattern: backslash
@@ -20,9 +25,12 @@ entries:
20
25
  - pattern: bona
21
26
  - pattern: bool
22
27
  - pattern: boolean
28
+ - pattern: botnet
23
29
  - pattern: browser
30
+ - pattern: burnout
24
31
  - pattern: callout
25
32
  - pattern: cannot
33
+ - pattern: cedent
26
34
  - pattern: changelog
27
35
  - pattern: checkbox
28
36
  - pattern: checkout
@@ -30,7 +38,10 @@ entries:
30
38
  - pattern: cli
31
39
  - pattern: codebase
32
40
  - pattern: codec
41
+ - pattern: combinator
33
42
  - pattern: config
43
+ - pattern: const
44
+ - pattern: conveniens
34
45
  - pattern: counterparty
35
46
  - pattern: covid
36
47
  - pattern: cron
@@ -42,10 +53,13 @@ entries:
42
53
  - pattern: dedup
43
54
  - pattern: dedupe
44
55
  - pattern: deploy
56
+ - pattern: designee
45
57
  - pattern: dev
46
58
  - pattern: devops
47
59
  - pattern: dialog
60
+ - pattern: distributee
48
61
  - pattern: dogfood
62
+ - pattern: doozy
49
63
  - pattern: dropdown
50
64
  - pattern: ebook
51
65
  - pattern: ecommerce
@@ -60,6 +74,8 @@ entries:
60
74
  - pattern: fide
61
75
  - pattern: filename
62
76
  - pattern: forma
77
+ - pattern: franchisee
78
+ - pattern: franchisor
63
79
  - pattern: frontend
64
80
  - pattern: generis
65
81
  - pattern: geospatial
@@ -67,6 +83,9 @@ entries:
67
83
  - pattern: hardcode
68
84
  - pattern: hardcoded
69
85
  - pattern: hashtag
86
+ - pattern: hereat
87
+ - pattern: herefrom
88
+ - pattern: hereon
70
89
  - pattern: hostname
71
90
  - pattern: html
72
91
  - pattern: http
@@ -76,12 +95,17 @@ entries:
76
95
  - pattern: inbox
77
96
  - pattern: incentivise
78
97
  - pattern: incentivize
98
+ - pattern: indemnitee
99
+ - pattern: indemnitor
79
100
  - pattern: init
80
101
  - pattern: inline
102
+ - pattern: intel
81
103
  - pattern: interoperability
82
104
  - pattern: interoperable
83
105
  - pattern: json
106
+ - pattern: keylogger
84
107
  - pattern: lest
108
+ - pattern: licensor
85
109
  - pattern: lifecycle
86
110
  - pattern: linter
87
111
  - pattern: localhost
@@ -89,27 +113,38 @@ entries:
89
113
  - pattern: logout
90
114
  - pattern: lookup
91
115
  - pattern: markdown
116
+ - pattern: mentee
92
117
  - pattern: meta
93
118
  - pattern: metadata
94
119
  - pattern: middleware
120
+ - pattern: minimis
95
121
  - pattern: modulo
122
+ - pattern: monies
96
123
  - pattern: multi
97
124
  - pattern: multiplet
98
125
  - pattern: mutex
99
126
  - pattern: namespace
100
127
  - pattern: npm
128
+ - pattern: obligee
129
+ - pattern: obligor
101
130
  - pattern: offline
102
131
  - pattern: offsite
103
132
  - pattern: onboard
104
133
  - pattern: onboarding
105
134
  - pattern: online
106
135
  - pattern: onsite
136
+ - pattern: optionee
107
137
  - pattern: param
108
138
  - pattern: params
109
139
  - pattern: parser
140
+ - pattern: partway
110
141
  - pattern: pauperis
142
+ - pattern: payor
111
143
  - pattern: payout
112
144
  - pattern: pdf
145
+ - pattern: pendency
146
+ - pattern: permittee
147
+ - pattern: pharming
113
148
  - pattern: phishing
114
149
  - pattern: plaintext
115
150
  - pattern: plugin
@@ -121,23 +156,30 @@ entries:
121
156
  - pattern: prepend
122
157
  - pattern: priori
123
158
  - pattern: quadrupole
159
+ - pattern: quishing
160
+ - pattern: ransomware
124
161
  - pattern: realtime
125
162
  - pattern: refactor
126
163
  - pattern: regex
127
164
  - pattern: regexp
165
+ - pattern: releasee
128
166
  - pattern: repo
129
167
  - pattern: reputational
168
+ - pattern: requestor
130
169
  - pattern: roadmap
170
+ - pattern: rootkit
131
171
  - pattern: runtime
132
172
  - pattern: sandbox
133
173
  - pattern: sans
134
174
  - pattern: scalability
175
+ - pattern: scareware
135
176
  - pattern: screenshot
136
177
  - pattern: sdk
137
178
  - pattern: sectoral
138
179
  - pattern: serverless
139
180
  - pattern: signup
140
181
  - pattern: smartphone
182
+ - pattern: smishing
141
183
  - pattern: snowmelt
142
184
  - pattern: soever
143
185
  - pattern: spreadsheet
@@ -146,10 +188,15 @@ entries:
146
188
  - pattern: strategize
147
189
  - pattern: struct
148
190
  - pattern: subfolder
191
+ - pattern: sublessee
192
+ - pattern: sublicensee
149
193
  - pattern: subproject
150
194
  - pattern: sustainably
151
195
  - pattern: syntax
196
+ - pattern: telecopy
152
197
  - pattern: thenceforward
198
+ - pattern: thereat
199
+ - pattern: thereunder
153
200
  - pattern: thereupon
154
201
  - pattern: timeline
155
202
  - pattern: timestamp
@@ -169,17 +216,23 @@ entries:
169
216
  - pattern: verbatim
170
217
  - pattern: versa
171
218
  - pattern: virtualize
219
+ - pattern: vishing
172
220
  - pattern: vitae
173
221
  - pattern: watersports
174
222
  - pattern: webhook
175
223
  - pattern: webinar
176
224
  - pattern: webpage
177
225
  - pattern: website
226
+ - pattern: whereat
178
227
  - pattern: whereby
228
+ - pattern: wherefrom
179
229
  - pattern: wherein
180
230
  - pattern: whereof
181
231
  - pattern: whereon
232
+ - pattern: whereto
233
+ - pattern: whereunder
182
234
  - pattern: whereupon
235
+ - pattern: wherewith
183
236
  - pattern: whilst
184
237
  - pattern: whitelist
185
238
  - pattern: whither
@@ -0,0 +1,6 @@
1
+ # Words between two numbers with a word of scale that let one unit serve both ("from $1.1 million to 1.3 million"),
2
+ # beyond range-connector and enumeration-joiner. number-without-unit does not read a number joined so as missing its unit.
3
+ id: figure-scale-joiner
4
+ language: en
5
+ entries:
6
+ - pattern: to
@@ -0,0 +1,9 @@
1
+ # Words of scale written right after a number ($83 million, 3 thousand cars). number-without-unit looks for the one
2
+ # number with such a word and no unit (83 million) where the other numbers with that word all carry one.
3
+ id: figure-scale-word
4
+ language: en
5
+ entries:
6
+ - pattern: thousand
7
+ - pattern: million
8
+ - pattern: billion
9
+ - pattern: trillion
@@ -5,6 +5,7 @@ id: instruction-verb
5
5
  language: en
6
6
  entries:
7
7
  - pattern: click
8
+ - pattern: partner
8
9
  - pattern: scroll
9
10
  - pattern: swipe
10
11
  - pattern: toggle
@@ -127,6 +127,11 @@ entries:
127
127
  instead_of: category
128
128
  - pattern: completly
129
129
  instead_of: completely
130
+ # complete + -ment: unknown-word takes it for a derived word, so only this list catches it.
131
+ - pattern: completement
132
+ instead_of: complement
133
+ - pattern: completements
134
+ instead_of: complements
130
135
  - pattern: compatability
131
136
  instead_of: compatibility
132
137
  - pattern: dissapoint
@@ -219,6 +224,9 @@ entries:
219
224
  instead_of: definitely
220
225
  - pattern: desparate
221
226
  instead_of: desperate
227
+ # Denger is a surname, so only the phrase
228
+ - pattern: denger zone
229
+ instead_of: danger zone
222
230
  - pattern: developement
223
231
  instead_of: development
224
232
  - pattern: dilemna
@@ -0,0 +1,9 @@
1
+ # What opens a note line written just under a list without indentation ("Note: documents are not returned."). Markdown
2
+ # reads that line as part of the last item; list-item-form-mix reads the item's form only up to it, since the note is
3
+ # about the whole list, not part of its last item.
4
+ id: list-note-lead
5
+ language: en
6
+ entries:
7
+ - pattern: "Note:"
8
+ - pattern: "NB:"
9
+ - pattern: "N.B."
@@ -0,0 +1,16 @@
1
+ # Words that say a quotation is a string to type as it stands (an e-mail subject, a file name, a title). Its brackets
2
+ # are the string's own and the writer cannot take them out. bracket-nesting counts such a quotation as one bracket when
3
+ # one of these stands right before it (position: before, as in with the subject line “…”) or right after it.
4
+ id: literal-quote-cue
5
+ language: en
6
+ entries:
7
+ - { pattern: subject line, position: before }
8
+ - { pattern: "subject:", position: before }
9
+ - { pattern: the subject, position: before }
10
+ - { pattern: file name, position: before }
11
+ - { pattern: filename, position: before }
12
+ - { pattern: "file name:", position: before }
13
+ - { pattern: named, position: before }
14
+ - { pattern: titled, position: before }
15
+ - pattern: as the subject
16
+ - pattern: as the file name
@@ -0,0 +1,16 @@
1
+ # The labels of a memorandum's header (TO:, FROM:, SUBJECT:), as a memo sets them: in capitals. A label in the header,
2
+ # before the first sentence, followed by a colon or the line's end, makes the document a memo, which takes no greeting
3
+ # and no closing. Matched with case, since a mail program's header writes "To:" and "Subject:".
4
+ id: memo-header-label
5
+ language: en
6
+ entries:
7
+ - pattern: MEMORANDUM
8
+ - pattern: MEMO
9
+ - pattern: TO
10
+ - pattern: FROM
11
+ - pattern: THROUGH
12
+ - pattern: THRU
13
+ - pattern: SUBJECT
14
+ - pattern: RE
15
+ - pattern: DATE
16
+ - pattern: CC
@@ -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,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
@@ -25,6 +25,11 @@ 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
28
33
  # group: template — a word that, in a heading, says the section is a template ("## Template", "# Sample letter").
29
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.
30
35
  - pattern: template
@@ -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
@@ -6,4 +6,7 @@ entries:
6
6
  - pattern: etc.
7
7
  - pattern: and so on
8
8
  - pattern: and the like
9
+ # In a contract "including, but not limited to" is a term of art: it keeps a court from narrowing the defined class to
10
+ # the examples listed, so the class named before it decides the scope. Specifications and documentation only.
9
11
  - pattern: but not limited to
12
+ genres: [technical, docs]
@@ -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,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,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
@@ -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
@@ -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
@@ -1,5 +1,6 @@
1
1
  # Words that join the start and the end of a period. date-without-year does not report the start of a period whose end
2
- # gives its year in words ("April 1 to March 31 of the following year"): like a fiscal year, it holds for any year.
2
+ # gives its year in words ("April 1 to March 31 of the following year"): like a fiscal year, it holds for any year. The
3
+ # start may name its year relative to the end ("6 April in one year to 5 April in the next"); those words join too.
3
4
  id: year-span-joiner
4
5
  language: en
5
6
  entries:
@@ -7,6 +8,9 @@ entries:
7
8
  - pattern: through
8
9
  - pattern: until
9
10
  - pattern: till
11
+ - pattern: in one year to
12
+ - pattern: of one year to
13
+ - pattern: one year to
10
14
  - pattern: "-"
11
15
  - pattern: –
12
16
  - pattern: —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaffjs/lang-en",
3
- "version": "0.32.0",
3
+ "version": "0.34.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