@@ -154,15 +154,17 @@ const CONTRAST = String.raw`(?:while|whereas|but|unlike|compared (?:with|to)|ver
154154const 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. */
156156const SENTENCE_END = / (?< = [ . ! ? ; ] [ ' " ” ’ ) \] ] * ) \s + /
157- /** ", and" before a capitalized word, which starts a clause with its own subject. */
158- const NEW_SUBJECT = / , \s + a n d \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 */
164166const 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. */
168170const 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+". */
180182const POSSESSIVE_OWNER = / ( [ \w . - ] + ) [ ' ’ ] s \s * $ /
181183/** A Sim count below this share of the catalog total is left from an older catalog. */
182184const 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+ */
185190function 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