Skip to content

Clean company names before they reach an email - #259

Open
wardjon31 wants to merge 2 commits into
ethanplusai:mainfrom
wardjon31:fix/clean-company-names
Open

wardjon31 wants to merge 2 commits into
ethanplusai:mainfrom
wardjon31:fix/clean-company-names

Conversation

@wardjon31

Copy link
Copy Markdown

What this changes

Company names come from page titles and URLs, and some reached drafts in forms like https://www.example.co.uk/'s badge, Welcome to Example Academy, Example FC l Ladies l or Example Co (a domain-derived name that took .co.uk's "co" for a word).

Every name is now cleaned as it's stored (add_company, add_prospect, rename_company), whichever path found it:

  • a URL becomes the name it spells;
  • a leading "Welcome to" is dropped;
  • a title is cut at its separator (including a lone "l" typed as a pipe) to the part the domain backs up;
  • a trailing "!" or ":" is dropped.

Domain-derived names now skip second-level suffixes (.co.uk, .ac.uk, .sch.uk, ...).

Stacked on #258 (the brand-exclusion PR) because the branches were built in order. The changes don't depend on each other, so until that one merges, review only the last commit here: "Clean company names before they reach an email".

How it was tested

  • tests/test_clean_company_name.py: parametrised cases for each rule, plus names that must be left alone (St. Example's School, Example O.N. Rovers FC), and a state test that add_company, add_prospect and rename_company store cleaned names. All fictional data.
  • tests/test_precleared_pause.py updated for the cleaned name.
  • Full suite: 3712 passed, 43 skipped.

Checklist

  • No real person's or business's name, email, phone, address or domain anywhere in the code, tests, docs or this description (CONTRIBUTING.md).
  • pytest passes.
  • Commits are signed off (git commit -s).
  • Docs and CHANGELOG.md updated if behaviour changed.

🤖 Generated with Claude Code

wardjon31 and others added 2 commits November 16, 2026 11:55
A retailer for one brand shouldn't cold-email a club already wearing it.
New icp.exclude_if_site_mentions lists the brands. Before writing, the
writer reads the company's homepage and up to six of its own kit, shop,
sponsor and about pages; a whole-word mention (text, link or image URL,
including a <brand>store link) marks the prospect 'excluded' and skips it.
The sender re-checks before sending so earlier drafts are caught, and
'excluded' joins the statuses that stop a sequence.

Verdicts are cached per company for 30 days; an unreadable site gives no
verdict and is retried. Off unless a brand is listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jon Ward <357348325+wardjon31@users.noreply.github.com>
Names come from page titles and URLs, and drafts were going out with
"https://www.example.co.uk/'s badge", "Welcome to Example Academy",
"Example FC l Ladies l" and "Example Co". Add clean_company_name and run
every stored name through it (add_company, rename_company, add_prospect):
a URL becomes the name it spells, "Welcome to" is dropped, a title is cut
at its separator (including a lone "l" used as a pipe) to the segment the
domain backs up, and trailing "!"/":" goes. name_from_domain and the
domain stem now strip second-level suffixes (.co.uk, .ac.uk, .sch.uk).

Two Precleared tests seeded a bare domain as the company name; they now
store the cleaned name, which is what the database holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jon Ward <357348325+wardjon31@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant