Skip to content

Commit ceabe2b

Browse files
committed
fix(library): check sim claims in feature-first table cells and treat digit product names as new subjects
1 parent 168317b commit ceabe2b

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

‎scripts/check-library-content.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,12 @@ describe('check-library-content', () => {
357357
['Sim, unlike Make.com, has 1,000+ integrations.', '1,000+ integrations', 'overstates'],
358358
['Sim connects tools like Slack to 1,000+ integrations.', '1,000+ integrations', 'overstates'],
359359
['Sim is open source but has 1,000+ integrations.', '1,000+ integrations', 'overstates'],
360+
['| Catalog | Sim has 1,000+ integrations |', '1,000+ integrations', 'overstates'],
361+
[
362+
'Sim has 280+ integrations while working across 9,000+ actions.',
363+
'9,000+ actions',
364+
'overstates',
365+
],
360366
['Sim is open source, but has 1,000+ integrations.', '1,000+ integrations', 'overstates'],
361367
[
362368
'While Sim is open source but has 1,000+ integrations, Zapier is proprietary.',
@@ -436,6 +442,8 @@ describe('check-library-content', () => {
436442
'"Sim is open source." Zapier has 9,000+ integrations.',
437443
'While Sim has 280+ integrations, 9,000+ integrations are available in Zapier.',
438444
'Sim has 280+ integrations, and Zapier has 9,000+ integrations.',
445+
'Sim has 280+ integrations, while n8n lists 2,000+ integrations.',
446+
'| Catalog | Sim has 280+ integrations | n8n lists 2,000+ integrations |',
439447
'While Sim has 280+ integrations, Zapier lists 9,000+ integrations.',
440448
'Zapier, like Sim, has 9,000+ integrations.',
441449
'Sim, unlike Zapier, which has 9,000+ integrations, is open source.',

‎scripts/check-library-content.ts‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,17 @@ const CONTRAST = String.raw`(?:while|whereas|but|unlike|compared (?:with|to)|ver
154154
const OPENING_CONTRAST = String.raw`(?:While|Whereas|But|Unlike|Like|Compared (?:with|to)|Versus|Vs\.?)`
155155
/** Sentence punctuation, with any closing quote or bracket, before whitespace. */
156156
const SENTENCE_END = /(?<=[.!?;]['"”’)\]]*)\s+/
157-
/** ", and" before a capitalized word, which starts a clause with its own subject. */
158-
const NEW_SUBJECT = /,\s+and\s+(?=[A-Z])/
157+
/** The start of a new subject: a capitalized word, or a lowercase product name with a digit (n8n). */
158+
const SUBJECT = String.raw`(?:[A-Z]|[a-z]+\d)`
159+
/** ", and" before a new subject, which starts a clause of its own ("..., and Zapier has ..."). */
160+
const NEW_SUBJECT = new RegExp(String.raw`,\s+and\s+(?=${SUBJECT})`)
159161
/**
160162
* Where a comparison clause starts: a sentence-opening contrast ("Unlike Sim, ..."), or a contrast
161-
* followed by a capitalized word, the new subject ("..., while Zapier", "Zapier, like Sim, ...").
162-
* A contrast that keeps the subject ("open source but has ...") does not start one.
163+
* followed by a new subject ("..., while Zapier", "Zapier, like Sim, ..."). A contrast that keeps
164+
* the subject ("open source but has ...", "while working") does not start one.
163165
*/
164166
const COMPARISON_START = new RegExp(
165-
String.raw`^(?=${OPENING_CONTRAST}\b)|,\s*(?=(?:like|${CONTRAST})\s+[A-Z])|\s+(?=${CONTRAST}\s+[A-Z])`
167+
String.raw`^(?=${OPENING_CONTRAST}\b)|,\s*(?=(?:like|${CONTRAST})\s+${SUBJECT})|\s+(?=${CONTRAST}\s+${SUBJECT})`
166168
)
167169
/** A count continuing a list ("..., 9,000+ actions, and 530+ triggers, ..."), not a new clause. */
168170
const COUNT_LIST_ITEM = String.raw`(?:and\s+)?\d[\d,]*\+?\s+(?:integrations|actions|triggers)\b\s*(?:,|and\b|$)`
@@ -175,18 +177,21 @@ const COMPARISON_END = new RegExp(
175177
String.raw`,(?!\d)(?!\s*(?:which|that|who)\b)(?!\s*${COUNT_LIST_ITEM})`
176178
)
177179
/** A contrast with a new subject inside a comparison clause ("..., but Zapier has ..."). */
178-
const INNER_CONTRAST = new RegExp(String.raw`,?\s+(?=${CONTRAST}\s+[A-Z])`)
180+
const INNER_CONTRAST = new RegExp(String.raw`,?\s+(?=${CONTRAST}\s+${SUBJECT})`)
179181
/** The product whose possessive directly precedes a count, as in "Zapier's 9,000+". */
180182
const POSSESSIVE_OWNER = /([\w.-]+)['’]s\s*$/
181183
/** A Sim count below this share of the catalog total is left from an older catalog. */
182184
const SIM_COUNT_FLOOR = 0.9
183185

184-
/** Every count in a table row whose label (first non-empty cell) names Sim. */
186+
/**
187+
* The Sim counts in a table row: every count when its label (first non-empty cell) names Sim, and
188+
* otherwise each cell's own Sim claims, read like prose ("| Catalog | Sim has 280+ integrations |").
189+
*/
185190
function simTableRowCounts(cells: string[]): RegExpMatchArray[] {
186191
const label = cells.map((cell) => cell.trim()).find((cell) => cell !== '') ?? ''
187192
return SIM_NAME.test(label.split(/\s/)[0])
188193
? cells.flatMap((cell) => [...cell.matchAll(COUNT_CLAIM)])
189-
: []
194+
: cells.flatMap(simProseCounts)
190195
}
191196

192197
/**

0 commit comments

Comments
 (0)