Sub topic 11
Automating the simple checks
This chapter assumes you can read short Python scripts and use regular expressions at a basic level. You should also have read the chapters on claim extraction and brand criteria. The goal is to automate the mechanical parts of review so that human attention goes to the judgments only a person can make.
What automation is for
A script can find text that matches a pattern. It cannot decide whether a statistic is true, whether a joke is exclusionary, or whether the voice sounds like your brand. Treat every automated check as a pre-check: a fast first pass that routes the draft and points the reviewer at likely problems.
Three rules keep pre-checks useful:
- A pre-check flags. It never approves. A draft with zero flags still goes to a human.
- A pre-check should be cheap to run and easy to explain. If a reviewer cannot tell why a sentence was flagged, they will stop trusting the tool.
- A pre-check should lean toward false positives. A flag that turns out to be harmless costs seconds. A missed invented statistic can cost a retraction.
Check 1: flag the claims to verify first
The claim-extraction chapter described how to find checkable claims by reading. A script can do a rough version of that reading. It looks for four kinds of text: percentages, currency amounts, superlatives, and attributions such as "studies show". It also looks for banned terms that your brand or legal team has ruled out.
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 term_found(term, sentence):
"""Match a term as a whole word or phrase, ignoring case."""
pattern = r"(?<!\w)" + re.escape(term) + r"(?!\w)"
return re.search(pattern, sentence, re.IGNORECASE) is not None
def flag_draft(text):
"""Return (label, sentence) pairs that a human must check."""
flags = []
for sentence in re.split(r"(?<=[.!?])\s+", text.strip()):
labels = []
for label, pattern in CLAIM_PATTERNS.items():
if re.search(pattern, sentence, re.IGNORECASE):
labels.append(label)
for term in BANNED_TERMS:
if term_found(term, sentence):
labels.append("banned_term")
for label in dict.fromkeys(labels): # drop duplicates, keep order
flags.append((label, 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:
superlative -> Our app is the fastest on the market.
percentage -> Studies show 87% of users save time.
attribution -> Studies show 87% of users save time.Compared with a bare substring search, this version has two changes. term_found matches whole words, so "guaranteed" does not fire inside an unrelated longer word. It also removes duplicate labels, so a sentence that mentions "risk-free" twice produces one flag.
What this check misses
The patterns catch the obvious shapes. They miss many others, and you should know which.
- Spelled-out numbers. "Nine out of ten customers" has no digit and no percent sign.
- Implied superlatives. "Nothing works faster" and "unmatched quality" contain none of the listed words.
- Unnamed sources. "Experts agree" is an attribution, but the pattern list does not include it.
- Product facts. A claim like "works offline" or "integrates with Slack" has no numeric signature, yet invented features are a common fabrication.
- Sentence splitting. The splitter breaks after any period followed by whitespace, so "Example Inc. is the leader" becomes two fragments. Flags still appear, but the sentence shown to the reviewer is cut off.
Extend the pattern list from your own rejected drafts. Each time a reviewer catches a claim the script missed, add a pattern for its shape. That feedback loop is covered later in the chapter on audit trails.
Check 2: terminology and spelling
Brand guidelines often contain rules that are purely mechanical: product names, capitalization, spellings, and forbidden phrases. These are good candidates for automation because the answer is the same no matter who checks.
import re
# Map each wrong form to the form the style guide requires.
PREFERRED_TERMS = {
"e-mail": "email",
"smart saver": "SmartSaver",
"smartsaver": "SmartSaver",
"Example Company": "Example Co",
}
def check_terminology(text):
"""Return (found, required) pairs for every wrong form in the text."""
problems = []
for wrong, right in PREFERRED_TERMS.items():
pattern = r"(?<!\w)" + re.escape(wrong) + r"(?!\w)"
if re.search(pattern, text, re.IGNORECASE):
problems.append((wrong, right))
return problems
sample = "Open a Smart Saver account and get updates by e-mail."
for wrong, right in check_terminology(sample):
print(f"Found '{wrong}', style guide says '{right}'")This prints only the e-mail line. The text "Smart Saver" is not in the table, because the table lists "smart saver" and the match is case-insensitive but the text has a capital S and a space. Wait: the match is case-insensitive, so "Smart Saver" does match "smart saver". The output therefore has two lines, for smart saver and e-mail.
That case-insensitive match has a cost. It cannot tell the correct form SmartSaver from the wrong form smartsaver, so the table above would flag correct copy. Fix this by matching case-sensitively for entries where the only difference is capitalization, or by removing the correct form from the text before searching. Whichever you choose, test the table against copy you know is correct, not only copy you know is wrong.
Check 3: structural rules from the rubric
In the brand-fit chapter you wrote a rubric with criteria such as voice, promises, terminology, and audience. Not every criterion needs a human. The table below shows how far automation can go for each one.
| Criterion | Can a script do it? | What the script can do |
|---|---|---|
| Terminology | Mostly | Match wrong forms and required spellings |
| Promises | Partly | Flag superlatives and banned terms, as in Check 1 |
| Voice | Barely | Count sentence length or jargon words, nothing more |
| Audience fit | No | Needs a person who knows the channel and the reader |
Scoring the whole rubric automatically invites a false sense of precision. A better pattern is to let the script fill in or suggest the scores for criteria it can judge, and leave the rest blank for the reviewer. Pass rules such as "no criterion scored 0" then work on a mixed set of scores that are partly automated and partly human.
Check 4: a gate that routes drafts
Once you have several checks, combine them into one function that returns a routing decision. The decision tells the workflow what to do next. It does not approve anything.
def prechecks(text):
"""Run all pre-checks and return a routing decision with its reasons."""
claim_flags = flag_draft(text)
term_problems = check_terminology(text)
banned = [f for f in claim_flags if f[0] == "banned_term"]
if banned:
route = "return_to_writer" # legal or brand has already ruled this out
elif claim_flags or term_problems:
route = "review_with_flags" # reviewer starts at the flagged sentences
else:
route = "review_standard" # still goes to a human
return {"route": route, "claims": claim_flags, "terms": term_problems}
result = prechecks("Open a Smart Saver account. Guaranteed returns, risk-free.")
print(result["route"])This prints return_to_writer. Banned terms are the one case where the script rejects automatically, because the rule was already decided by people. Every other path still ends with a human reading the draft.
Failure modes and maintenance
Automated checks fail in predictable ways. Plan for each.
- Alert fatigue. If most flags are harmless, reviewers skim past them. Measure the share of flags that led to a change, and remove or narrow patterns that rarely do.
- False confidence. Reviewers may relax when the tool reports few flags. State in the review instructions that the checklist applies in full regardless of the tool's output.
- Pattern drift. Campaigns introduce new product names and new claim types. Review the term table and pattern list on a schedule, such as once per quarter.
- Gaming. If writers see the banned list, they may reword to dodge it: "can't lose" instead of "risk-free". Treat the list as a floor, and keep human review for meaning.
- Language coverage. Regular expressions written for English miss currency formats, number words, and punctuation in other languages. Build a separate set per language rather than reusing one.
Exercise
Exercise
A draft contains the sentence "Nine out of ten dentists prefer our toothpaste." Run through the flag_draft patterns in this chapter. Does the script flag it, and what change would you make so that a reviewer sees it?
Show answer
The script does not flag it. "Nine out of ten" has no digit and no percent sign, so the percentage pattern does not match, and the sentence contains no superlative, attribution phrase, or banned term. It is an unsupported statistic and an implied endorsement, so a reviewer should check it. One fix is to add a pattern for spelled-out ratios, for example 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", under a "percentage" or "ratio" label. A second pattern for professional endorsements, such as "dentists prefer", would also help. Either pattern should be tested on correct copy to see how much noise it adds.
Exercise
Why does prechecks return "review_standard" instead of "approved" when no flags are found?
Show answer
Because no flags means only that none of the script's patterns matched. The script cannot detect invented product features, fake quotes, bias, or an off-brand voice, so a person must still review the draft.