Licensing, Consent, and Data-Use Signals › Worked example: eleven documents, three purposes
Language AI HandbookAll chapters Before writing the resolver, apply the example policy to a few documents by hand. The corpus is deliberately small and the signals deliberately varied.
| Document | Licence | Terms | robots.txt | TDM reserved | Registry | Source | Outcome |
|---|---|---|---|---|---|---|---|
wiki-eu | CC-BY-SA-4.0 | allowed | allow | no | no | EU | allow with obligations |
gov-us | CC0-1.0 | allowed | allow | no | no | US | allow |
blog-eu | none | unknown | allow | no | no | EU | review |
news-us | none | prohibited | disallow | no | no | US | exclude |
code-mit | MIT | allowed | allow | no | no | US | allow with obligations |
art-eu | none | unknown | allow | no | yes | EU | exclude |
news-eu | none | unknown | allow | yes | no | EU | exclude |
For blog-eu, the example records no licence or known reservation. It identifies Article 4 as a possible basis and sends the record to review. Clearing the unknown terms would leave the record in review because the resolver has no evidence of lawful access or the other conditions of the exception.
For news-eu, the example policy treats the reservation header as an exclusion signal. With that flag removed, the record would go to review like blog-eu.
For art-eu, the example excludes the record before evaluating the other signals. The honor_registries parameter controls that early registry check in this policy.
The resolver applies the same policy to the other eight fixtures. The licence-and-access screen checks the registry first. A matching registry entry ends that screen. Otherwise it checks crawl rules, reservations, licences, possible statutory bases, and platform terms in that order. The before-use privacy hold is initialized independently.
PythonIn [18]Expand
class Purpose(Enum):
RESEARCH = "research"
EVALUATION = "evaluation"
COMMERCIAL_TRAINING = "commercial_training"
class Jurisdiction(Enum):
EU = "EU"
US = "US"
UK = "UK"
JP = "JP"
OTHER = "other"
class Decision(Enum):
ALLOW = "allow"
ALLOW_WITH_OBLIGATIONS = "allow_with_obligations"
REVIEW = "review"
EXCLUDE = "exclude"
LEVELS = {
Decision.ALLOW: 0,
Decision.ALLOW_WITH_OBLIGATIONS: 1,
Decision.REVIEW: 2,
Decision.EXCLUDE: 3,
}
DECISION_ORDER = ["allow", "allow_with_obligations", "review", "exclude"]
PURPOSE_ORDER = ["research", "evaluation", "commercial_training"]PythonIn [19]Expand
@dataclass
class Document:
doc_id: str
host: str
license_expr: Optional[str]
tos_training: str # "allowed" | "prohibited" | "unknown"
robots_allowed: bool
tdm_reserved: bool
registry_optout: bool
personal_data: bool
jurisdiction: Jurisdiction
excerpt: str = field(metadata={"signal": False})
@dataclass
class Resolution:
doc_id: str
purpose: str
jurisdiction: str
decision: str
reasons: list
obligations: list
triggers: list
privacy_gate: strThe licence-and-access screen keeps the highest severity reached during a run. At each bump, the decision advances only if the new finding is more restrictive. A later permissive finding leaves an earlier restriction in place. The before-use privacy hold is a separate field.
PythonIn [20]Expand
def resolve(doc, purpose, honor_registries=True):
status = Decision.ALLOW
reasons, obligations, triggers = [], [], []
privacy_gate = "hold_before_use" if doc.personal_data else "not_flagged"
def task(stage, action):
obligations.append({"stage": stage, "task": action})
def bump(level, reason, trigger):
nonlocal status
if LEVELS[level] > LEVELS[status]:
status = level
reasons.append(reason)
triggers.append(trigger)
# 1. This policy gives a registry exclusion precedence.
if doc.registry_optout and honor_registries:
bump(
Decision.EXCLUDE,
"listed in a do-not-train registry",
"registry_opt_out",
)
return Resolution(
doc.doc_id,
purpose.value,
doc.jurisdiction.value,
status.value,
reasons,
obligations,
triggers,
privacy_gate,
)
# 2. Crawl directives govern fetching, not training, so a violation
# here is a governance flag rather than a licence term.
if not doc.robots_allowed:
bump(
Decision.REVIEW,
"robots.txt disallows this crawler",
"robots_disallow",
)
# 3. This policy excludes flagged reservations, even if a licence is recorded.
if doc.tdm_reserved:
bump(
Decision.EXCLUDE,
"machine-readable TDM reservation",
"tdm_reservation",
)
# 4. The licence, if one exists.
if doc.license_expr is None:
bump(
Decision.REVIEW,
"no licence recorded: verify an applicable basis",
"no_licence",
)
else:
profile = evaluate_expression(doc.license_expr, purpose.value)
if profile.unknown:
bump(
Decision.REVIEW,
f"licence {doc.license_expr!r} is not mapped",
"unknown_licence",
)
if profile.non_commercial and purpose is Purpose.COMMERCIAL_TRAINING:
bump(
Decision.EXCLUDE,
f"{profile.name}: non-commercial clause",
"non_commercial",
)
if profile.no_derivatives:
bump(
Decision.REVIEW,
f"{profile.name}: no-derivatives clause",
"no_derivatives",
)
if profile.share_alike:
bump(
Decision.ALLOW_WITH_OBLIGATIONS,
f"{profile.name}: share-alike",
"share_alike",
)
task(
"before_release", "track share-alike sources for release review"
)
if profile.copyleft:
bump(
Decision.ALLOW_WITH_OBLIGATIONS,
f"{profile.name}: copyleft",
"copyleft",
)
task("at_generation", "filter verbatim code reproduction")
if profile.attribution:
bump(
Decision.ALLOW_WITH_OBLIGATIONS,
f"{profile.name}: attribution",
"attribution",
)
task("before_release", "list the source in the data card")
# 5. Record possible statutory bases for review when no licence is recorded.
if doc.license_expr is None and not doc.tdm_reserved:
if doc.jurisdiction is Jurisdiction.EU:
bump(
Decision.REVIEW,
"EU Art. 4 may apply: verify its conditions",
"statute_eu_tdm",
)
task(
"before_use",
"verify the Art. 4 basis and record the reservation check date",
)
elif doc.jurisdiction is Jurisdiction.JP:
bump(
Decision.REVIEW,
"JP Art. 30-4 may apply; scope is contested",
"statute_jp",
)
elif doc.jurisdiction is Jurisdiction.US:
bump(
Decision.REVIEW,
"US: fair use for training is unresolved",
"statute_us_fair_use",
)
else:
bump(
Decision.REVIEW,
"no established exception in source jurisdiction",
"statute_other",
)
# 6. Apply the hypothetical terms outcomes independently.
if doc.tos_training == "prohibited":
bump(
Decision.EXCLUDE, "terms of use prohibit this use", "tos_prohibited"
)
elif doc.tos_training == "unknown":
bump(Decision.REVIEW, "terms of use not captured", "tos_unknown")
# 7. Keep the privacy hold separate from the screening decision.
if doc.personal_data:
reasons.append("contains personal data")
triggers.append("personal_data")
task(
"before_use",
"privacy review: lawful basis, minimisation, erasure path",
)
return Resolution(
doc.doc_id,
purpose.value,
doc.jurisdiction.value,
status.value,
reasons,
obligations,
triggers,
privacy_gate,
)Each row is a synthetic summary. In production, keep the dated source observations and their evidence references, including any sources consulted after the original fetch.
PythonIn [21]Expand
corpus = [
Document(
"wiki-eu",
"en.wikipedia.org",
"CC-BY-SA-4.0",
"allowed",
True,
False,
False,
False,
Jurisdiction.EU,
"An encyclopaedia paragraph on subword tokenisation.",
),
Document(
"gov-us",
"nist.gov",
"CC0-1.0",
"allowed",
True,
False,
False,
False,
Jurisdiction.US,
"A public-domain US government technical report.",
),
Document(
"blog-eu",
"personal-blog.example",
None,
"unknown",
True,
False,
False,
False,
Jurisdiction.EU,
"A practitioner's blog post with no licence statement.",
),
Document(
"news-us",
"news.example",
None,
"prohibited",
False,
False,
False,
False,
Jurisdiction.US,
"A news article behind a restrictive terms-of-use page.",
),
Document(
"forum-us",
"forum.example",
"CC-BY-NC-4.0",
"allowed",
True,
False,
False,
True,
Jurisdiction.US,
"A forum thread whose footer declares CC BY-NC 4.0.",
),
Document(
"code-mit",
"github.com",
"MIT",
"allowed",
True,
False,
False,
False,
Jurisdiction.US,
"A permissively licensed source file.",
),
Document(
"code-gpl",
"github.com",
"GPL-3.0-only",
"allowed",
True,
False,
False,
False,
Jurisdiction.US,
"A copyleft source file with a licence header.",
),
Document(
"wire-us",
"wire.example",
"LicenseRef-negotiated-commercial",
"allowed",
True,
False,
False,
False,
Jurisdiction.US,
"A news wire item delivered under a signed agreement.",
),
Document(
"art-eu",
"artist.example",
None,
"unknown",
True,
False,
True,
False,
Jurisdiction.EU,
"An artist's portfolio page listed on a do-not-train registry.",
),
Document(
"news-eu",
"eu-news.example",
None,
"unknown",
True,
True,
False,
False,
Jurisdiction.EU,
"An EU news page that returns a TDM reservation header.",
),
Document(
"blog-eu-robots",
"eu-blog.example",
None,
"unknown",
False,
False,
False,
False,
Jurisdiction.EU,
"An EU blog post already in the corpus whose robots.txt now blocks AI crawlers.",
),
]PythonIn [22]Expand
records = []
for purpose in Purpose:
for doc in corpus:
res = resolve(doc, purpose)
records.append(
{
"doc_id": res.doc_id,
"purpose": res.purpose,
"jurisdiction": res.jurisdiction,
"decision": res.decision,
"reasons": res.reasons,
"obligations": res.obligations,
"triggers": res.triggers,
"privacy_gate": res.privacy_gate,
}
)
results = pd.DataFrame(records)| jurisdiction | screening_decision | privacy_gate | reasons | |
|---|---|---|---|---|
| doc_id | ||||
| wiki-eu | EU | allow_with_obligations | not_flagged | CC BY-SA 4.0: share-alike; CC BY-SA 4.0: attri... |
| gov-us | US | allow | not_flagged | |
| blog-eu | EU | review | not_flagged | no licence recorded: verify an applicable basi... |
| news-us | US | exclude | not_flagged | robots.txt disallows this crawler; no licence ... |
| forum-us | US | exclude | hold_before_use | CC BY-NC 4.0: non-commercial clause; CC BY-NC ... |
| code-mit | US | allow_with_obligations | not_flagged | MIT: attribution |
| code-gpl | US | allow_with_obligations | not_flagged | GPL-3.0: copyleft; GPL-3.0: attribution |
| wire-us | US | allow | not_flagged | |
| art-eu | EU | exclude | not_flagged | listed in a do-not-train registry |
| news-eu | EU | exclude | not_flagged | machine-readable TDM reservation; no licence r... |
| blog-eu-robots | EU | review | not_flagged | robots.txt disallows this crawler; no licence ... |
The GPL example is allowed with tasks under this screen. The EU blog record contains one crawler decision, a disallow. Its use basis is unresolved, so the screen sends it to review. To determine whether the rule changed after the fetch, compare the two dated observations described above.
ConsoleOut [24]Expand
decision allow 2 allow_with_obligations 3 review 2 exclude 4 research allow=2 obligations=4 review=2 exclude=3 evaluation allow=2 obligations=4 review=2 exclude=3 commercial_training allow=2 obligations=3 review=2 exclude=4
The policy treats research and evaluation as non-commercial. The licence-and-access screen allows forum-us with obligations for those purposes and excludes it for commercial training. The separate before-use privacy hold applies in all three cases. The other ten records keep the same screening decision across the three purposes. The manifest preserves the purpose, jurisdiction, screening decision and privacy gate.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!