SyntaxComplexityBranchingFactorExtractor#
Defined in: voxatlas.features.syntax.complexity.branching_factor
- class voxatlas.features.syntax.complexity.branching_factor.SyntaxComplexityBranchingFactorExtractor[source]#
Bases:
BaseExtractorExtract the
syntax.complexity.branching_factorfeature within the VoxAtlas pipeline.This public extractor defines the reusable API for computing
syntax.complexity.branching_factorfrom VoxAtlas structured inputs. It consumessentenceunits and produces values aligned tosentenceunits, making the extractor a stable pipeline node that can be cited independently of the surrounding execution machinery.Algorithm#
The extractor converts token-level dependency annotations into sentence-level structural complexity statistics.
Sentence partitioning The dependency table is split by sentence so each statistic is computed on a well-defined local parse.
Tree construction VoxAtlas reconstructs a dependency tree rooted at the sentence head.
Complexity computation Branching factor is computed as the mean number of children per non-leaf dependency node.
Packaging One scalar is returned per sentence, aligned to the sentence identifiers used elsewhere in the pipeline.
Notes
This extractor declares the upstream dependencies [‘syntax.dependencies’] and is executed only after those features are available in the pipeline feature store.
Examples
>>> import pandas as pd >>> from voxatlas.features.feature_input import FeatureInput >>> from voxatlas.features.feature_output import TableFeatureOutput >>> from voxatlas.features.syntax.complexity.branching_factor import SyntaxComplexityBranchingFactorExtractor >>> from voxatlas.pipeline.feature_store import FeatureStore >>> deps = pd.DataFrame({"token_id": [1, 2, 3], "head_id": [2, 0, 2], "dep_label": ["nsubj", "root", "obj"], "sentence_id": [0, 0, 0]}) >>> store = FeatureStore() >>> store.add("syntax.dependencies", TableFeatureOutput(feature="syntax.dependencies", unit="token", values=deps)) >>> out = SyntaxComplexityBranchingFactorExtractor().compute(FeatureInput(audio=None, units=None, context={"feature_store": store}), {}) >>> float(out.values.loc[0]) 2.0
- name: str = 'syntax.complexity.branching_factor'#
- input_units: str | None = 'sentence'#
- output_units: str | None = 'sentence'#
- dependencies: list[str] = ['syntax.dependencies']#
- default_config: dict = {}#
- compute(feature_input, params)[source]#
Compute the extractor output for a single pipeline invocation.
This method is the reusable execution entry point for the extractor. It receives the standard
FeatureInputbundle, applies the configured algorithm, and returns feature values aligned to the extractor output units for storage in the pipeline feature store.- Parameters:
feature_input (object) – Structured extractor input bundling audio, hierarchical units, and execution context for this feature computation.
params (object) – Resolved feature configuration for this invocation. Keys are feature-specific and merged from defaults and pipeline settings.
- Returns:
Structured output aligned to the
sentenceunit level when applicable.- Return type:
FeatureOutput
Examples
>>> import pandas as pd >>> from voxatlas.features.feature_input import FeatureInput >>> from voxatlas.features.feature_output import TableFeatureOutput >>> from voxatlas.features.syntax.complexity.branching_factor import SyntaxComplexityBranchingFactorExtractor >>> from voxatlas.pipeline.feature_store import FeatureStore >>> deps = pd.DataFrame({"token_id": [1], "head_id": [0], "dep_label": ["root"], "sentence_id": [0]}) >>> store = FeatureStore() >>> store.add("syntax.dependencies", TableFeatureOutput(feature="syntax.dependencies", unit="token", values=deps)) >>> result = SyntaxComplexityBranchingFactorExtractor().compute(FeatureInput(audio=None, units=None, context={"feature_store": store}), {}) >>> result.unit 'sentence'