Sub topic 11
Automating the Simple Checks
This chapter assumes you have read the chapters on finding claims and on turning brand guidelines into criteria. It also assumes you can read basic Python. Automation here means a first-pass filter that tells a reviewer where to look. It does not decide whether copy is true, fair, or on brand.
What a script can and cannot do
A script is good at pattern matching. It can find numbers, percentages, currency amounts, superlatives, attributions, and banned words. These are the sentences a human should verify first.
A script cannot tell whether "87% of users save time" is true. It cannot judge tone or notice a stereotype. Treat a clean result as "nothing obvious matched," not as "approved."
| Check | Automate? | Why |
|---|---|---|
| Numbers, prices, percentages | Yes | Simple patterns find them |
| Banned terms ("guaranteed", "risk-free") | Yes | Exact word match |
| Superlatives and attributions | Yes, with review | Patterns over-match and under-match |
| Is the claim true? | No | Needs a primary source |
| Bias and tone | Only partly | Needs human judgment |
A claim flagger
This script splits a draft into sentences and labels each sentence that matches a pattern.
import re
CLAIM_PATTERNS = {
"percentage": r"\b\d+(?:\.\d+)?\s?%",
"currency": r"[$€£]\s?\d[\d,]*(?:\.\d+)?",
"superlative": r"\b(?:best|fastest|leading|only|first|top)\b",
"attribution": r"\b(?:studies show|research shows|according to)\b",
}
BANNED_TERMS = ["guaranteed", "risk-free", "miracle", "#1"]
def flag_draft(text):
"""Return (label, sentence) pairs that a human must check."""
flags = []
for sentence in re.split(r"(?<=[.!?])\s+", text.strip()):
for label, pattern in CLAIM_PATTERNS.items():
if re.search(pattern, sentence, re.IGNORECASE):
flags.append((label, sentence))
for term in BANNED_TERMS:
if term.lower() in sentence.lower():
flags.append(("banned_term", sentence))
return flags
draft = "Our app is the fastest on the market. Studies show 87% of users save time."
for label, sentence in flag_draft(draft):
print(label, "->", sentence)Running it prints three lines: a superlative flag for the first sentence, then an attribution flag and a percentage flag for the second. A sentence can appear more than once because it matches more than one pattern. That is intended, since each label suggests a different kind of check.
Encoding the brand rubric
The same idea works for brand criteria. A rubric file turns a style guide into questions with a scale and a pass rule. A person or a model-assisted step scores each question, and a script applies the pass rule so every reviewer reaches the same decision.
brand: Example Co
criteria:
- id: voice
question: Is the copy in plain, direct language with no jargon?
scale: 0-2
- id: promises
question: Does the copy avoid guarantees and superlatives we cannot support?
scale: 0-2
- id: terminology
question: Are product and feature names spelled and capitalized as in the style guide?
scale: 0-2
- id: audience
question: Does the copy fit the stated audience and channel?
scale: 0-2
pass_rule: total score at least 6 of 8 and no criterion scored 0The "no criterion scored 0" rule matters. Without it, a draft could score well on three criteria while failing one badly, such as making a promise you cannot support.
Generating swap-test prompts
Bias testing needs the same prompt run for several audience groups. A short helper builds those prompts so none are forgotten.
def audience_variants(prompt_template, groups):
"""Build one prompt per audience group from a template with a {group} slot."""
return {group: prompt_template.format(group=group) for group in groups}
template = "Write a two-sentence ad for our savings account aimed at {group}."
groups = ["young professionals", "retirees", "first-generation immigrants", "small business owners"]
for group, prompt in audience_variants(template, groups).items():
print(group, "->", prompt)
# Send each prompt to the model, then compare the outputs side by side
# for differences in tone, assumptions, and the offers mentioned.The script only builds prompts. A person still reads the outputs side by side and decides whether differences in tone, assumptions, or offers are justified.
Common errors
- Trusting a clean result. A draft with no flags can still contain a false claim written in words your patterns do not cover.
- Over-tuning the patterns. Adding every banned phrase creates noise, and reviewers start ignoring the flags.
- Missing spelled-out numbers. "Nine out of ten" does not match the percentage pattern. Add patterns for the forms your team uses.
- Letting the script replace a reviewer. Keep a named person responsible for the final decision.
Exercise
The flagger finds no matches in a draft that says "Nine out of ten dentists prefer our brush." What should you do, and how could you improve the script?
Show answer
Do not treat the draft as approved. The sentence is a checkable claim that the script missed because it contains a spelled-out ratio instead of a digit or percent sign. A reviewer should verify it against a primary source. To improve the script, add a pattern such as r"\b(?:one|two|three|four|five|six|seven|eight|nine|ten) out of (?:one|two|three|four|five|six|seven|eight|nine|ten)\b" to CLAIM_PATTERNS, and add a label such as "ratio".