Skip to content

Commit 67603e5

Browse files
committed
fix(library): keep sim-count comparison spans inside their sentence
1 parent ec36581 commit 67603e5

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@ describe('check-library-content', () => {
339339
'overstates',
340340
],
341341
['Sim, unlike n8n, has 1,000+ integrations.', '1,000+ integrations', 'overstates'],
342+
[
343+
'Zapier lists thousands of apps, while Make lists 3,000 apps. Sim has 1,000+ integrations, and more.',
344+
'1,000+ integrations',
345+
'overstates',
346+
],
342347
[
343348
'While Sim has 1,000+ integrations, Zapier focuses on simple automations.',
344349
'1,000+ integrations',

‎scripts/check-library-content.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,12 @@ const SIM_NAME = /\bSim\b/
150150
const CONTRAST = String.raw`(?:while|whereas|but|unlike|compared (?:with|to)|versus|vs\.?)`
151151
/**
152152
* A comparison set off by commas, as in "Sim, unlike Zapier, has ..." or "Zapier, like Sim, has
153-
* ...", removed so the sentence keeps its subject. The span ends at the first comma that is not a
154-
* thousands separator, and it is kept when a relative clause follows ("unlike Zapier, which has").
153+
* ...", removed so the sentence keeps its subject. The span stays inside its sentence, ends at the
154+
* first comma that is not a thousands separator, and is kept when a relative clause follows
155+
* ("unlike Zapier, which has").
155156
*/
156157
const PARENTHETICAL_COMPARISON = new RegExp(
157-
String.raw`,\s+(?:like|${CONTRAST})\s+(?:[^,]|,(?=\d))*?,(?!\d)(?!\s*(?:which|that|who)\b)`,
158+
String.raw`,\s+(?:like|${CONTRAST})\s+(?:[^,.!?;]|[,.](?=\d))*?,(?!\d)(?!\s*(?:which|that|who)\b)`,
158159
'gi'
159160
)
160161
/** A sentence end, or a contrast that hands the rest of the sentence to another subject. */
@@ -164,7 +165,7 @@ const CLAUSE_BREAK = new RegExp(String.raw`(?<=[.!?;])\s+|,?\s+${CONTRAST}\s+`,
164165
* that states a count of its own ("While Sim has 280+ integrations, ...") is kept.
165166
*/
166167
const LEADING_COMPARISON = new RegExp(
167-
String.raw`^(?:like|${CONTRAST})\b(?:[^,]|,(?=\d))*?,(?!\d)\s*`,
168+
String.raw`^(?:like|${CONTRAST})\b(?:[^,.!?;]|[,.](?=\d))*?,(?!\d)\s*`,
168169
'i'
169170
)
170171
/** The product whose possessive directly precedes a count, as in "Zapier's 9,000+". */

0 commit comments

Comments
 (0)