ADR-224: Implement intent stages (PhraseVariator, VocabComputer, DVC entry-points)#217
Merged
jodavis merged 9 commits intoJun 11, 2026
Conversation
jodavis-claude
force-pushed
the
dev/claude/ADR-223-implement-modifierstage-abstract-base
branch
from
June 11, 2026 01:54
286b6b9 to
6f04420
Compare
jodavis
requested changes
Jun 11, 2026
jodavis
left a comment
Owner
There was a problem hiding this comment.
This review is suggesting a pretty large design change, so we'll start with this. The PhraseVariator needs to use VariationGenerator in order to keep variations consistent, otherwise we will end up with large differences when parameters change.
…riables Moves variations_per_phrase, subsample_rate, and the five probability floats out of source code and into a central params.yaml so they can be tracked and overridden as DVC parameters.
…producible randomisation Replace injectable rng: random.Random with vgen_factory: Callable[[int], VariationGenerator] and five probability float constructor params. Remove module-level _*_CHANCE constants. In generate(), use random.Random(42) to draw a phrase_seed per base phrase, then random.Random(phrase_seed) to draw a variant_seed per variant, and pass each seed to vgen_factory to get a VariationGenerator for that variant's _create_variation() call. In _create_variation(), replace all self._rng.* calls with vgen.should_vary(), vgen.choose(), and vgen.generate_int() using the stable variable name strings specified in ADR-224. Update tests to use the new constructor signature and a factory lambda.
…iables Remove --variations-per-phrase and --subsample-rate from argparse. Load all five probability floats, variations_per_phrase, and subsample_rate from ml/params.yaml (resolved relative to __file__). Construct PhraseVariator with the factory lambda and probability params from the YAML.
jodavis
requested changes
Jun 11, 2026
… object, PhraseVariator params object, move TestConventions - conventions.params_path(project_root) centralises the params.yaml path - PipelineParams/GeneratePhraseParams dataclasses deserialise params.yaml into a typed object - PhraseVariator.__init__ now takes GeneratePhraseParams instead of five individual floats - TestConventions moved from test_vocab_computer.py to its own test_conventions.py file Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jodavis
approved these changes
Jun 11, 2026
…tall from it in CI pyyaml was used in ml/pipeline/stages/params.py and ml/test/pipeline/stages/test_params.py but was not listed as a dependency. The CI workflow only ran `pip install pytest`, so pyyaml was never installed. Added ml/requirements.txt with pytest and pyyaml>=6.0, and updated the python-tests job to install from that file instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jodavis
enabled auto-merge (rebase)
June 11, 2026 22:40
jodavis
disabled auto-merge
June 11, 2026 22:40
jodavis
enabled auto-merge (squash)
June 11, 2026 22:40
jodavis
deleted the
dev/claude/ADR-223-implement-modifierstage-abstract-base
branch
June 11, 2026 22:46
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.
ADR-224 — Intent Stages: PhraseVariator, VocabComputer, DVC Entry-Points
Summary
Implements Task 3 of the OOP pipeline refactor (
ml/_spec_OopPipeline.md): theml/pipeline/intent/package,ml/pipeline/stages/conventions.py, and the first two DVC entry-points.Files Added
ml/pipeline/intent/phrase_variator.pyPhraseVariatorclass with injectablerng: random.Randomgenerate(base_phrases, variations_per_phrase)returnslist[TextSample]_create_variation()andsanity_check()from the legacy01_generate_phrases.pyscript; allrandom.*calls replaced withself.rng.*TextSampleconstructed withseed=0,content_hash=sha256(content),content=surface_form,label=commandml/pipeline/intent/vocab_computer.pyVocabComputer,VocabResult,PhonemeProvider,PhonemeNotFoundErrorcompute(manifest, output_dir)extracts words fromTextSample.label(splitting on_), not contentphoneme_list.txtandwords_to_phonemes.json; nophoneme_trie.jsonVocabResult.ctc_blank_idx = len(phoneme_list)ml/pipeline/stages/conventions.pymanifest_path,split_manifest_path,sample_file_path,model_path,evaluation_predictions_path,evaluation_metrics_path,test_samples_pathml/pipeline/stages/intent_01_generate_phrases.py--input-phrases,--output-dir,--variations-per-phrase,--subsample-ratePhraseVariator(random.Random(42)), applies subsample filter, writesManifest[TextSample]ml/pipeline/stages/intent_02_compute_vocab.py--input-manifest-dir,--output-dir,--phoneme-dict_CmuPhonemeProviderfor CMU Pronouncing Dictionary formatVocabComputer, callscompute()ml/test/pipeline/intent/test_phrase_variator.pyseed=0,content_hashintegrity, variant count)VariationGeneratorml/test/pipeline/intent/test_vocab_computer.pywords_to_phonemesmapping;ctc_blank_idx == len(phoneme_list)phoneme_list.txt,words_to_phonemes.json)TestConventions: all seven convention functions verifiedBuild & Test
AdaptiveRemote.App.Tests+ 55AdaptiveRemote.Speech.Tests)MessagePack.AnnotationsDLL not copied aftergit clean(fixed in this PR by adding direct package reference toAdaptiveRemote.App.csproj)AdaptiveRemote.runtimeconfig.jsonmissing aftergit clean(pre-existing, not introduced here)Design Notes
TextSample.idis content-addressable (= content_hash) per the existingsample.pyimplementation — the spec's mention ofuuid4()is superseded by the actual dataclassVocabComputersplits label words on_(e.g.TV_ON→["TV", "ON"])phoneme_trie.jsonml/tosys.pathfor direct invocation compatibility