Metadata-Version: 2.4
Name: liwca
Version: 0.1.0a1
Summary: Linguistic Inquiry Word Count Assistant
Author-email: Remington Mallett <mallett.remy@gmail.com>
Maintainer-email: Remington Mallett <mallett.remy@gmail.com>
Project-URL: Homepage, https://github.com/remrama/liwca
Keywords: LIWC,text,language,datasets
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy>=1.25
Requires-Dist: openpyxl>=3.0
Requires-Dist: pandas>=2.2
Requires-Dist: pandera>=0.27
Requires-Dist: pooch>=1.8
Requires-Dist: scikit-learn>=1.3
Provides-Extra: dev
Requires-Dist: mypy>=1.12; extra == "dev"
Requires-Dist: pre-commit>=3.0; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=6.0; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: sphinx>=7.0; extra == "dev"
Requires-Dist: pydata-sphinx-theme>=0.16; extra == "dev"
Dynamic: license-file

[![Project Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Tests](https://github.com/remrama/liwca/actions/workflows/tests.yaml/badge.svg)](https://github.com/remrama/liwca/actions/workflows/tests.yaml)
[![PyPI](https://img.shields.io/pypi/v/liwca.svg)](https://pypi.org/project/liwca/)
[![Downloads](https://img.shields.io/pypi/dm/liwca.svg)](https://pypi.org/project/liwca/)
[![Python Versions](https://img.shields.io/pypi/pyversions/liwca.svg)](https://pypi.org/project/liwca/)
[![License](https://img.shields.io/pypi/l/liwca.svg)](https://github.com/remrama/liwca/blob/main/LICENSE.txt)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

# LIWCA

LIWCA (Linguistic Inquiry Word Count Assistant) offers helper functions for working with LIWC dictionaries. Useful when you want end-to-end pipelines or notebook workflows that don't require the LIWC-22 app to be open, or when you just need reusable `.dic[x]` file I/O without writing it from scratch every project.

Features:

- Reading and writing dictionary files (`.dic`/`.dicx`)
- Merging dictionary files
- Fetching public LIWC-format dictionaries from remote repositories
- Pure-Python word counting (no LIWC-22 needed)
- Calling `liwc-22-cli` from Python

## Installation

```shell
pip install --upgrade liwca
```

## Quick Start

```python
import liwca

# Fetch a public dictionary and count words (no LIWC-22 needed)
dx = liwca.fetch_threat()
results = liwca.scikit(["danger lurks ahead"], dx)
```

## Usage

### Fetching dictionaries

```python
import liwca

dx = liwca.fetch_sleep()           # Fetch and load a public dictionary
dx = liwca.fetch_bigtwo()          # Versioned dictionary (version="a" by default)
dx = liwca.read_dx("./my.dicx")    # Read a local dictionary file
liwca.write_dx(dx, "./my.dic")     # Write to a different format
```

### Word counting

Pure-Python word counting using LIWC-style dictionaries (no LIWC-22 needed).

```python
texts = ["I feel happy today", "This is a sad story"]
results = liwca.scikit(texts, dx)                      # percentages (default)
results = liwca.scikit(texts, dx, as_percentage=False)  # raw counts
```

### LIWC-22 wrapper (requires LIWC-22)

The LIWC-22 desktop application (or its license server) must be running when you call the CLI.
See the [LIWC CLI documentation](https://www.liwc.app/help/cli) and [Python CLI example](https://github.com/ryanboyd/liwc-22-cli-python/blob/main/LIWC-22-cli_Example.py) for more details.

```python
liwca.liwc22("wc", input="data.csv", output="results.csv")
```

## Similar Projects

- [liwc-python](https://github.com/chbrown/liwc-python)
- [lingmatch](https://github.com/miserman/lingmatch)
- [sentibank](https://github.com/socius-org/sentibank)
