---
type: "Source File"
title: "\"\"\"Reject descriptive placeholders that are not actual company names."
description: "\"\"\"Reject descriptive placeholders that are not actual company names. The layoffs extractor sometimes returns the article's *description* of an employer (\"biggest UK vape wholesaler\", \"University (BBC Essex campus)\")."
resource: "https://layoffs.copecheck.com"
tags: ["copecheck", "layoffs", "source-file", "py"]
timestamp: "2026-09-25T22:07:20Z"
site: "layoffs"
source_path: "copecheck-layoffs/company_validation.py"
---

# """Reject descriptive placeholders that are not actual company names.

Source path: `copecheck-layoffs/company_validation.py`  
Index snapshot generated: `2026-11-24T13:27:52Z`  
File modified: `2026-09-25T22:07:20Z`

```py
"""Reject descriptive placeholders that are not actual company names.

The layoffs extractor sometimes returns the article's *description* of an
employer ("biggest UK vape wholesaler", "University (BBC Essex campus)")
instead of a name. Those strings must not publish.

`validate_company(name)` -> (ok: bool, reason: str)
`reason` is "" when ok is True.

Design notes
------------
Real company names keep their generic suffix capitalised ("Kellogg Company",
"The Coca-Cola Company"). Descriptions do not ("Bellevue firm", "Eye health
company"). That single signal, plus an explicit anonymity vocabulary and a
"nothing distinctive left" check, covers the observed artifacts without
touching legitimate names.
"""
from __future__ import annotations

import re

# Strings that openly say the employer was not identified.
ANONYMITY = re.compile(
    r"\b(unnamed|unknown|unspecified|undisclosed|anonymous|confidential|"
    r"not\s+named|no\s+name|n/?a|tbd|redacted|withheld|various|multiple|"
    r"several|assorted|numerous)\b",
    re.I,
)

# Aggregate / industry-level strings that are never one employer.
AGGREGATE = re.compile(
    r"\b(multiple\s+companies|industry|sector[- ]wide|companies|employers|"
    r"firms|businesses|organisations|organizations)\b",
    re.I,
)

# Generic head nouns. A name *ending* in one of these is only a real name when
# the noun is capitalised and something distinctive precedes it.
GENERIC_HEAD = {
    "company", "companies", "firm", "firms", "giant", "giants", "chain",
    "chains", "employer", "employers", "wholesaler", "wholesalers",
    "retailer", "retailers", "maker", "makers", "manufacturer",
    "manufacturers", "supplier", "suppliers", "distributor", "distributors",
    "operator", "operators", "provider", "providers", "startup", "startups",
    "business", "businesses", "agency", "agencies", "contractor",
    "contractors", "outfit", "brand", "brands", "chainstore", "conglomerate",
    "multinational", "organisation", "organization", "employer's",
}

# A head noun that is *never* part of a real registered name.
NEVER_A_NAME_HEAD = {"giant", "giants", "outfit", "multinational", "conglomerate"}

# Words that carry no identifying information on their own.
NON_DISTINCTIVE = {
    # articles / filler
    "the", "a", "an", "of", "and", "for", "in", "at", "on", "to", "&", "-",
    "based", "area", "county", "city", "town", "region", "district", "campus",
    # scale / vagueness
    "major", "minor", "large", "largest", "small", "smallest", "big",
    "biggest", "leading", "top", "global", "international", "national",
    "regional", "local", "worldwide", "well-known", "prominent", "huge",
    "key", "main", "mass", "popular", "famous", "well", "known",
    # geography that commonly prefixes a description
    "us", "u.s.", "usa", "uk", "u.k.", "british", "american", "european",
    "eu", "canadian", "australian", "indian", "german", "french", "irish",
    "scottish", "welsh", "english", "japanese", "chinese", "dutch", "swiss",
    "nordic", "asian", "african", "bay", "silicon", "valley", "midwest",
    "northern", "southern", "eastern", "western", "north", "south", "east",
    "west",
    # sectors
    "tech", "technology", "technologies", "software", "hardware", "banking",
    "bank", "finance", "financial", "insurance", "insurer", "retail",
    "grocery", "supermarket", "transport", "transportation", "travel",
    "airline", "aviation", "clothing", "apparel", "fashion", "military",
    "defence", "defense", "pharma", "pharmaceutical", "pharmaceuticals",
    "biotech", "biotechnology", "soda", "beverage", "beverages", "alcohol",
    "drinks", "food", "auto", "automotive", "car", "electronics",
    "electrical", "lighting", "construction", "media", "publishing",
    "energy", "oil", "gas", "utility", "utilities", "telecom", "telecoms",
    "telecommunications", "healthcare", "health", "hospital", "logistics",
    "shipping", "manufacturing", "industrial", "mining", "hospitality",
    "hotel", "restaurant", "education", "university", "college", "school",
    "cycling", "eye", "breakfast", "production", "chemical", "chemicals",
    "semiconductor", "semiconductors", "gaming", "games", "ecommerce",
    "e-commerce", "consulting", "consultancy", "marketing", "advertising",
    "recruitment", "staffing", "legal", "law", "accounting", "real",
    "estate", "property", "agriculture", "vape", "vaping", "tobacco",
    "fit-out", "service", "services", "store", "stores", "distribution",
    "warehouse", "ticketing", "streaming", "social",
}

# Words that actively signal "this is a description, not a name". Only these
# (or lowercasing, or a trailing parenthetical) may condemn a string that has
# no generic head noun — otherwise real names built entirely from common words
# ("British Gas", "US Bank", "British American Tobacco") would be rejected.
VAGUE_MARKERS = {
    "major", "minor", "largest", "biggest", "leading", "top", "local",
    "regional", "key", "main", "private", "global", "international",
    "unknown", "unnamed", "industry", "aggregate", "large", "small", "big",
    "well-known", "prominent", "huge", "popular", "famous", "based",
    "area", "county", "suburban", "eastside",
}

MIN_LEN = 2
MAX_LEN = 80

[redacted secret-like line]


[redacted secret-like line]
[redacted secret-like line]


def _strip_punct(tok: str) -> str:
    return tok.strip(".,;:()[]\"'`").strip()


def validate_company(name) -> tuple[bool, str]:
    """Return (ok, reason). Descriptive placeholders return (False, reason)."""
    if name is None:
        return False, "empty"
    raw = str(name).strip()
    if len(raw) < MIN_LEN:
        return False, "empty"
    if len(raw) > MAX_LEN:
        return False, "too_long"
    if not re.search(r"[A-Za-z]", raw):
        return False, "no_letters"

    # A parenthetical qualifier attached to a bare generic noun is a
    # description, e.g. "University (BBC Essex campus)".
    core = re.sub(r"\s*\([^)]*\)\s*$", "", raw).strip()

    if ANONYMITY.search(raw):
        return False, "anonymity_marker"
    if AGGREGATE.search(raw):
        return False, "aggregate_or_industry"

[redacted secret-like line]
    toks = [t for t in toks if t]
    if not toks:
        return False, "empty"

    head_raw = toks[-1]
    head = head_raw.lower()

    if head in NEVER_A_NAME_HEAD:
        return False, "descriptive_head_noun"

    if head in GENERIC_HEAD:
        # A real name capitalises its own suffix: "Kellogg Company".
        if head_raw[:1].islower():
            return False, "lowercase_generic_head"
        # Title-cased but nothing identifying in front of it.
        rest = [t for t in toks[:-1]]
        distinctive = [
            t for t in rest if t.lower() not in NON_DISTINCTIVE
        ]
        if not distinctive:
[redacted secret-like line]

    # Whole string is generic vocabulary with no head noun at all. Only
    # condemn it when something else marks it as a description: a vagueness
    # word, a lowercase word, or a trailing parenthetical qualifier. Without
    # that guard this rule would reject "British Gas" and "US Bank".
    if all(t.lower() in NON_DISTINCTIVE or t.lower() in GENERIC_HEAD for t in toks):
        has_vague = any(t.lower() in VAGUE_MARKERS for t in toks)
        has_lower = any(t[:1].islower() for t in toks)
        has_paren = core != raw
        if has_vague or has_lower or has_paren:
[redacted secret-like line]

    return True, ""


def is_valid_company(name) -> bool:
    return validate_company(name)[0]
```
