models

Data models and URL bundles for the alignment package

AlignmentStepState

TypedDict for Phase 2 right column (VAD alignment) state.


source

AlignmentStepState


def AlignmentStepState(
    args:VAR_POSITIONAL, kwargs:VAR_KEYWORD
):

State for Phase 2 (right column): Temporal Alignment.

VADChunk

Represents a voice activity detection time range from the VAD plugin.


source

VADChunk


def VADChunk(
    index:int, start_time:float, end_time:float, audio_file_index:int=0
)->None:

A voice activity detection time range.

AlignmentUrls

URL bundle for Phase 2 alignment route handlers and renderers.


source

AlignmentUrls


def AlignmentUrls(
    card_stack:CardStackUrls=<factory>, init:str='', audio_src:str='', toggle_auto_nav:str=''
)->None:

URL bundle for Phase 2 alignment route handlers and renderers.

Tests

# VADChunk with audio_file_index
chunk = VADChunk(index=0, start_time=1.0, end_time=3.5, audio_file_index=2)
assert chunk.audio_file_index == 2
assert chunk.duration == 2.5
d = chunk.to_dict()
assert d["audio_file_index"] == 2
assert VADChunk.from_dict(d).audio_file_index == 2

# Backward compat: missing audio_file_index defaults to 0
legacy = {"index": 5, "start_time": 0.0, "end_time": 1.0}
assert VADChunk.from_dict(legacy).audio_file_index == 0

# Legacy field removal still works
legacy_with_assigned = {"index": 0, "start_time": 0.0, "end_time": 1.0, "assigned_segment": None}
assert VADChunk.from_dict(legacy_with_assigned).audio_file_index == 0
print("VADChunk model tests passed")