DEV Community

Emin
Emin

Posted on AI-assisted

$10 is a price, $1.9T is a stat: pulling real numbers out of landing pages

A coding agent writing a comparison page needs real numbers: customers, traffic, prices. Landing pages are full of numbers, but most are not claims. A price, a TLS version, a year, "2 min ago" in a product mockup.

easybrandkit, my CLI that turns a website into a brand kit for agents, has a --facts flag for this. It reads the home, pricing, customers, security, integrations and about pages and lists what the site claims, each with its page. No model, just rules, and most of them say no.

1. A stat is drawn bigger than its label

"135+" in large type, "currencies and payment methods supported" under it in small type. A figure counts only if it is at least 20px and 1.25 times the size of its label.

const size = textSize(page, figure);
if (!(size >= 20 && size >= 1.25 * textSize(page, item, figure))) continue;
Enter fullscreen mode Exit fullscreen mode

Seven or more figures in one small box is a dashboard drawn on the page, not a row of stats. None of them are taken.

2. Money without a magnitude is a price

"$5.46" is a price, "$1.9T" is a stat. The magnitude list goes beyond English: k, M, B, T, bn, million, Mio, Mrd, milyon, milyar.

if (new RegExp(`^(?:${CURRENCY})`).test(line))
  return new RegExp(MAGNITUDE).test(digits.replace(/^[\d.,\s]+/, ""));
Enter fullscreen mode Exit fullscreen mode

Without currency, a figure needs a magnitude, +, %, x, or a value of 10 or more. "1" and "02" are steps, "2019" is a year.

3. Look 12 characters back for a version

"3,000 users" is a claim, "TLS 1.2+" is not. Before taking a number, the code checks the 12 characters before it for TLS, iOS, Node, Python, "version" and the like. Sentences with "off", "save", "starting at", "fee" or "/mo" are skipped. The pricing page is not read for stats at all.

linear.app

Six pages, 11 numbers, among them:

"Linear powers over 50,000 product teams." (home)
"3.3x Faster issue resolution" (customers)
"Why OpenAI chose Linear and scaled to 3,000 users" (customers)
"How Scale compressed bug resolution time by 52%" (customers)
Enter fullscreen mode Exit fullscreen mode

Left out: the mockup on the home page ("DRV-8852", "1 / 84", "2 min ago"), "$10 per user/month", "SOC 2 Type II", "TLS 1.2", "AES 256-bit". Prices and standards go to their own sections of the kit.

If you write one of these

  • Use what the page draws, not just the HTML. Font size did more than any regex.
  • Write the rejections first. They outnumber real claims.
  • Keep the source text next to each claim so it can be checked.
  • Treat page text as data. It can be written to steer an agent.

It misses numbers inside images and videos, closed tabs, and prices behind a currency switch.

https://github.com/EminBudak/easybrandkit
https://www.npmjs.com/package/easybrandkit

Top comments (2)

Collapse
 
florian131313 profile image
G •

2019 clears the rule that keeps any value of 10 or more. The 12-character lookback only trips on words like version or TLS, so a year sitting in a normal sentence is not caught there. Is there a separate range check for four-digit years, and does it run before that >= 10 test?

Collapse
 
eminbudak profile image
Emin •

Yes, it runs first: exactly 19xx or 20xx is dropped before the 10-or-more test. Sentences skip that test anyway; a number there needs a magnitude, %, +, x or a separator like 3,000, so a bare 2019 never counts.

⌂ 换网址