Skip to main content

Linguistic Inquiry Word Count Assistant

Project description

PyPI Python Versions Downloads License Tests Coverage Ruff Repo Status

liwca logo banner

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

pip install --upgrade liwca

Quick Start

import liwca

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

Usage

Fetching dictionaries

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).

texts = ["I feel happy today", "This is a sad story"]
results = liwca.count(texts, dx)                      # percentages (default)
results = liwca.count(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 and Python CLI example for more details.

import pandas as pd

liwc = liwca.liwc22.Liwc22(encoding="utf-8", count_urls=True)
df = pd.DataFrame({"doc_id": ["a", "b"], "text": ["...", "..."]})
out_path = liwc.wc(
    input=df,                      # DataFrame or path
    output="results.csv",
    row_id_indices=["doc_id"],
    include_categories=["anger", "joy"],
)
results = pd.read_csv(out_path, index_col=0)

Similar Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liwca-0.1.0a3.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liwca-0.1.0a3-py3-none-any.whl (35.6 kB view details)

Uploaded Python 3

File details

Details for the file liwca-0.1.0a3.tar.gz.

File metadata

  • Download URL: liwca-0.1.0a3.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for liwca-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 d53cb34c7aa5f4bf1c4ce8cb79630d37951be757d8102d0b53e837264d952e9e
MD5 25e63d7bd2b2afa6a505f3c51387a26e
BLAKE2b-256 475858de23845e244f984387395419d3db8dde64959568a9a316d157e2183785

See more details on using hashes here.

Provenance

The following attestation bundles were made for liwca-0.1.0a3.tar.gz:

Publisher: release.yaml on remrama/liwca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liwca-0.1.0a3-py3-none-any.whl.

File metadata

  • Download URL: liwca-0.1.0a3-py3-none-any.whl
  • Upload date:
  • Size: 35.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for liwca-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 743ea969dcd4b9d1fa989a7ebd2c0f24548a60fc6ad5bc050e5621206d94b962
MD5 d53b83e6f23678bf412e371a2c8ddeb4
BLAKE2b-256 59f2e8477f379448299b4a845be3c5da120d336fa1d19ffafc99881ddf368796

See more details on using hashes here.

Provenance

The following attestation bundles were made for liwca-0.1.0a3-py3-none-any.whl:

Publisher: release.yaml on remrama/liwca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page