AnimacyExtractor#

Defined in: voxatlas.features.lexical.properties.animacy

class voxatlas.features.lexical.properties.animacy.AnimacyExtractor[source]#

Bases: BaseExtractor

Extract the lexical.properties.animacy feature within the VoxAtlas pipeline.

This public extractor defines the reusable API for computing lexical.properties.animacy from VoxAtlas structured inputs. It consumes token units and produces values aligned to token units, making the extractor a stable pipeline node that can be cited independently of the surrounding execution machinery.

Algorithm#

The extractor computes a lookup-based lexical property from a resource table or token annotation.

  1. Token preparation Token rows are normalized so that text, lemma, or aligned subunit identifiers can be queried consistently.

  2. Property computation The feature value follows

    \[x_i = L(w_i).\]
  3. Packaging The resulting token-level series is returned without altering the original unit index.

Notes

This extractor declares the upstream dependencies [‘lexical.properties.lookup’] 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.lexical.properties.animacy import AnimacyExtractor
>>> from voxatlas.pipeline.feature_store import FeatureStore
>>> table = pd.DataFrame({"id": [1], "animacy": [1.0]})
>>> store = FeatureStore()
>>> store.add("lexical.properties.lookup", TableFeatureOutput(feature="lexical.properties.lookup", unit="token", values=table))
>>> out = AnimacyExtractor().compute(FeatureInput(audio=None, units=None, context={"feature_store": store}), {})
>>> float(out.values.loc[1])
1.0
name: str = 'lexical.properties.animacy'#
input_units: str | None = 'token'#
output_units: str | None = 'token'#
dependencies: list[str] = ['lexical.properties.lookup']#
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 FeatureInput bundle, 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 token unit 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.lexical.properties.animacy import AnimacyExtractor
>>> from voxatlas.pipeline.feature_store import FeatureStore
>>> table = pd.DataFrame({"id": [1], "animacy": [1.0]})
>>> store = FeatureStore()
>>> store.add("lexical.properties.lookup", TableFeatureOutput(feature="lexical.properties.lookup", unit="token", values=table))
>>> result = AnimacyExtractor().compute(FeatureInput(audio=None, units=None, context={"feature_store": store}), {})
>>> result.unit
'token'