Skip to content

Declares item slot, element and feature-path names (0.12.0) - #17

Merged
aaronstevenwhite merged 6 commits into
mainfrom
fix/declared-item-names
Nov 4, 2026
Merged

aaronstevenwhite merged 6 commits into
mainfrom
fix/declared-item-names

Conversation

@aaronstevenwhite

Copy link
Copy Markdown
Collaborator

Description

Removes the "verb" default from cross_product_slot on the three cross-product generators, so the caller names the slot and the <slot>_lemma and <slot>_form rendered elements are named after it. Adds keyword-only text_element and prompt_element (and unit_element in magnitude, instructions_element in cloze) to every task item factory and batch helper in bead.items, and text_element and prompt_element to family_to_item_template, realization_to_item, protocol_to_item_templates and realize_protocol_to_items. realization_to_item refuses an element name its template does not declare, so validate_item's element-set agreement holds, and derived spans reference the declared text element. StratifiedStrategy resolves each segment of grouping_property as a mapping key as well as an attribute, so "features.<key>" groups by the feature value. Documents the new keywords and releases the changes as bead 0.12.0.

Motivation

Callers building items for their own data need to name the slot a cross product varies, the elements a factory writes, and the feature a stratified sample groups by. Removing the slot default is a breaking change, so the release is a minor bump under bead's pre-1.0 versioning.

Fixes #16

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Tests (adding or updating tests)

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the project's style guidelines
  • I have run uv run ruff check . and uv run ruff format .
  • I have run uv run pyright with no errors
  • I have added tests that prove my fix/feature works
  • All tests pass (uv run pytest tests/)
  • I have updated documentation as needed

Testing

  • Python CI suite: 3,659 passed, 57 skipped, 257 deselected
  • Ruff 0.14.14 lint and format checks
  • Pyright: 0 errors
  • TypeScript build and gallery build
  • MkDocs build
  • Version consistency tests for 0.12.0
  • New tests were run before each fix and failed as expected: tests/items/test_generation.py (new mirror of bead/items/generation.py), TestDeclaredElementNames in the protocol bridge tests and in each task factory's test module, and the feature-path grouping tests in tests/templates/test_strategies.py

Other hard-coded names found in generic code and left unchanged, since each is a reader, a heuristic or a metadata key rather than a name a factory writes:

  • _extract_text_from_item in each task factory module falls back over "text", "sentence" and "content"; callers can override it with extract_text.
  • get_task_type_requirements, validate_item_for_task_type and infer_task_type_from_item in bead/items/validation.py assume "text" and "prompt".
  • ClozeModel reads rendered_elements["text"] (bead/active_learning/models/cloze.py).
  • The cloze simulation strategy's fallback fillers are keyed by slot names such as "verb" and "noun" (bead/simulation/strategies/cloze.py).
  • create_nli_item writes the item_metadata keys "premise", "hypothesis" and "task".
  • bead/interop/layers/item_bridge.py and bead/interop/layers/corpus_io.py default the element name to "text".
  • gallery/eng/argument_structure/generate_cross_product.py calls verb_lexicon.items.values(), but Lexicon.items is a tuple; it does not use the cross-product generators, so it is outside this change.

Screenshots (if applicable)

Not applicable.

@aaronstevenwhite
aaronstevenwhite merged commit 89d93d3 into main Nov 4, 2026
8 checks passed
@aaronstevenwhite
aaronstevenwhite deleted the fix/declared-item-names branch November 4, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let callers name the cross-product slot, item elements and stratified feature paths

1 participant