build_tools.syllable_walk_tui.modules.oscillator.state

State management for oscillator module.

This module provides the PatchState dataclass for managing individual patch configurations, including isolated RNG instances and corpus data.

Classes

PatchState

State for a single patch configuration.

Module Contents

class build_tools.syllable_walk_tui.modules.oscillator.state.PatchState[source]

State for a single patch configuration.

Maintains isolated RNG instance to avoid global random state contamination.

name

Identifier for this patch (e.g., “A” or “B”)

seed

Random seed for reproducible generation

rng

Isolated Random instance for this patch

corpus_dir

Path to corpus directory (None if not selected)

corpus_type

Detected corpus type (“NLTK” or “Pyphen”, None if not selected)

# Quick metadata
Type:

loaded immediately, 50KB

syllables

List of unique syllables loaded from corpus (None if not loaded)

frequencies

Dictionary mapping syllable to frequency count (None if not loaded)

# Full phonetic feature data
Type:

loaded in background, 15MB

annotated_data

List of syllable dicts with phonetic features (None if not loaded)

is_loading_annotated

Flag indicating background loading in progress

loading_error

Error message if annotated data failed to load (None if no error)

# Walk profile parameters
Type:

defaults to "Dialect" profile

min_length

Minimum syllable character count (1-10)

max_length

Maximum syllable character count (1-10)

walk_length

Number of syllables to chain (2-20)

max_flips

Maximum feature changes per step (1-3)

temperature

Exploration randomness, higher = more chaos (0.1-5.0)

frequency_weight

Bias toward common (+) or rare (-) syllables (-2.0 to 2.0)

neighbor_limit

Candidate pool size per step (5-50)

outputs

Generated names from last generation

name: str
seed: int
current_profile: str = 'dialect'
corpus_dir: pathlib.Path | None = None
corpus_type: str | None = None
syllables: list[str] | None = None
frequencies: dict[str, int] | None = None
annotated_data: list[dict] | None = None
is_loading_annotated: bool = False
loading_error: str | None = None
min_length: int = 2
max_length: int = 5
walk_length: int = 5
max_flips: int = 2
temperature: float = 0.7
frequency_weight: float = 0.0
neighbor_limit: int = 10
walk_count: int = 2
outputs: list[str] = []
generate_seed()[source]

Generate a new random seed using system entropy.

Returns:

New random seed value

Return type:

int

Note

Uses SystemRandom to avoid global random state contamination.

is_ready_for_generation()[source]

Check if patch has all required data loaded for name generation.

A patch is ready when: 1. Corpus directory is selected 2. Quick metadata (syllables, frequencies) is loaded 3. Annotated data with phonetic features is loaded 4. Not currently loading 5. No loading errors

Returns:

True if patch can generate names, False otherwise

Return type:

bool