liwca.create_dx#

liwca.create_dx(categories)[source]#

Create a dictionary DataFrame from category-to-terms mapping.

Parameters:

categories (dict[str, list[str]]) – Mapping of category names to lists of dictionary terms. Terms may include LIWC-style wildcards (e.g., "abandon*").

Returns:

Validated dictionary DataFrame with terms as rows and categories as columns (binary int8 values).

Return type:

pandas.DataFrame

Examples

>>> import liwca
>>> dx = liwca.create_dx(
...     {
...         "sports": ["baseball", "football", "hockey"],
...         "weather": ["rain*", "snow", "wind*"],
...     }
... )