Shared Label Assets¶
Trace keeps repo-wide reusable text labels under src/trace_tasks/resources/assets/labels/. Use this
layer for visible node labels, chart categories, page names, legend names,
organization-style tokens, place names, and other prompt/render labels that are
not task-specific.
Rules¶
- Load labels through
trace_tasks.tasks.shared.name_assets. Graph-domain tasks should usetrace_tasks.tasks.graph.shared.label_assetsinstead, which applies the graph label caps and eligible-bucket rules on top of these same manifests. - Keep task-specific constraints at the task call site. For example, a graph
task that needs short edge labels should filter
mixed/compact_labels.txtwithmin_chars,max_chars,allow_spaces, andallow_punctuationinstead of creating a graph-only manifest. - Do not hardcode new one-off proper-name lists inside task modules.
- Use only permissively licensed or public-domain sources. Add the source and
local license metadata to
src/trace_tasks/resources/assets/labels/sources.jsonwhen a manifest is added or regenerated. - Runtime generation must read vendored manifests only. Do not download label data during task generation.
- If a task needs answer strings, make sure the rendered label, answer value, and verifier normalization policy are decided together. Avoid silent case-folding unless the verifier explicitly supports it.
Available Pools¶
people/first_names_ssa.txtpeople/surnames_census_2010.txtplaces/countries_natural_earth.txtplaces/cities_natural_earth.txtorganizations/company_tickers_sec.txtorganizations/company_terms_sec.txtcategories/abstract_group_labels.txtcategories/priority_labels.txtcategories/product_labels.txtcategories/status_labels.txtoccupations/occupations_bls_oews.txtindustries/industries_bls_qcew.txtmixed/proper_labels.txtmixed/compact_labels.txt- Generated chart-only entity bucket:
temporal
For chart-domain tasks, prefer trace_tasks.tasks.charts.shared.label_assets over
calling load_label_manifest(...) directly. That helper exposes reusable
entity-label and category-label bucket selection while still recording the
manifest/filter metadata needed for trace diagnostics. The chart temporal
entity bucket is generated at runtime rather than loaded from a manifest because
it must return ordered sequences. It participates in the same bucket-weight
maps as manifest-backed entity buckets and may internally sample consecutive
years, fiscal years, quarters, months, or month-day labels while preserving
chronological order.
API¶
from trace_tasks.tasks.shared.name_assets import load_label_manifest
labels = load_label_manifest(
"mixed/compact_labels.txt",
min_chars=5,
max_chars=10,
allow_spaces=False,
allow_punctuation=False,
compact_length=False,
)
For short alphabetic token pools such as Braille/Morse word options, use the global helper built on this same manifest layer:
from trace_tasks.tasks.shared.word_assets import load_short_word_bank_by_length
words_by_length = load_short_word_bank_by_length(min_length=3, max_length=5)
The helper defaults to a common leading slice of people/first_names_ssa.txt,
normalizes tokens to lowercase, groups by exact length, and keeps up to 1000
candidates per length bucket. Override the manifest, length support, or pool cap
only when a task has a concrete rendering or semantics reason.
Do not create scene-local word lists when a filtered shared label manifest is adequate.
Use load_label_sources() when runtime tooling or documentation needs source
and license metadata.
When updating a vendored manifest, normalize ASCII labels, deduplicate them
case-insensitively, and update sources.json and local license metadata in the
same change.