dstk.hooks package#
Submodules#
dstk.hooks.data_conversion module#
This module provides utilities and hooks for converting data between different formats. It bridges the gap between internal data structures and common analysis formats, making it easier to manipulate linguistic data.
Core functionalities include:
Converting neural word embedding models (such as Word2Vec or FastText) into pandas DataFrames for easier statistical analysis.
Transforming sequences of lexical items into standard text strings.
Providing standardized “Hooks” that allow these conversion processes to be easily integrated into the a model’s workflow.
The module is primarily intended to facilitate the transition from raw model outputs to structured data suitable for further linguistic research and analysis.
dstk.hooks.tools module#
This module provides the Hook class, which serves as a wrapper for wrapping callable methods into a strict single-argument interface. It is designed to facilitate the creation of modular pipelines where each processing step (a hook) receives one primary piece of data while still allowing for optional configuration via keyword arguments.
Core functionalities include:
Wrapping any callable function into a Hook object to standardize how it is called within a larger model.
Enforcing a single-argument constraint at runtime, ensuring that each hook focuses on one primary input.
Separating the “main” argument from optional keyword arguments (defaults), allowing for cleaner configuration of complex text processing steps.
Validating method signatures to ensure compatibility before execution.
This module is particularly useful for building extensible NLP pipelines where different linguistic tasks (e.g., lemmatization, tagging, or filtering) need to be chained together in a consistent manner.
- class dstk.hooks.tools.Hook(method: Callable[[...], Any])[source]#
Bases:
objectRepresents a callable hook that wraps a single-argument function.
A Hook encapsulates a method that must accept exactly one argument, enabling modular processing steps or callbacks within models.
- Parameters:
name (str) – A descriptive name for the hook.
method (Callable[..., Any]) – A callable that takes exactly one argument.