Repository navigation
Declares item slot, element and feature-path names (0.12.0) - #17
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes the
"verb"default fromcross_product_sloton the three cross-product generators, so the caller names the slot and the<slot>_lemmaand<slot>_formrendered elements are named after it. Adds keyword-onlytext_elementandprompt_element(andunit_elementinmagnitude,instructions_elementincloze) to every task item factory and batch helper inbead.items, andtext_elementandprompt_elementtofamily_to_item_template,realization_to_item,protocol_to_item_templatesandrealize_protocol_to_items.realization_to_itemrefuses an element name its template does not declare, sovalidate_item's element-set agreement holds, and derived spans reference the declared text element.StratifiedStrategyresolves each segment ofgrouping_propertyas 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
Checklist
uv run ruff check .anduv run ruff format .uv run pyrightwith no errorsuv run pytest tests/)Testing
tests/items/test_generation.py(new mirror ofbead/items/generation.py),TestDeclaredElementNamesin the protocol bridge tests and in each task factory's test module, and the feature-path grouping tests intests/templates/test_strategies.pyOther 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_itemin each task factory module falls back over"text","sentence"and"content"; callers can override it withextract_text.get_task_type_requirements,validate_item_for_task_typeandinfer_task_type_from_iteminbead/items/validation.pyassume"text"and"prompt".ClozeModelreadsrendered_elements["text"](bead/active_learning/models/cloze.py)."verb"and"noun"(bead/simulation/strategies/cloze.py).create_nli_itemwrites theitem_metadatakeys"premise","hypothesis"and"task".bead/interop/layers/item_bridge.pyandbead/interop/layers/corpus_io.pydefault the element name to"text".gallery/eng/argument_structure/generate_cross_product.pycallsverb_lexicon.items.values(), butLexicon.itemsis a tuple; it does not use the cross-product generators, so it is outside this change.Screenshots (if applicable)
Not applicable.