Skip to main content

txtures

txtures computes word- and region-level features of text for psycholinguistic research: surprisal from causal language models on the Hugging Face hub, with word-boundary correction; unigram and n-gram surprisal from KenLM models trained on a corpus such as OpenWebText; word length; part of speech and named entities from Stanza; and dependency locality (DLT integration cost) with the variants of Shain et al. (2022). Regions are words by default and can be defined by the user.

txtures is in early development. Its interfaces will change during the 0.x series.

Installation

From a checkout on Linux or macOS:

./install

This downloads a pinned uv and Python and installs txtures with its locked dependencies into txtures-install/ in the checkout, without using or changing any Python already on the machine. It puts a txtures command in ~/.local/bin. Useful options:

  • --compute cpu installs PyTorch without CUDA (the default on Linux is CUDA).
  • --site DIR uses a lab's txtures home, which holds its definitions, stored results, and models. txtures site use DIR does the same later.
  • --prefix DIR installs somewhere other than the checkout.
  • --upgrade first updates the checkout to the newest release.

Later, txtures install --upgrade moves an installation to the newest release with the same choices, and txtures install reinstalls it.

On a Slurm cluster, txtures site set slurm.partition=NAME makes txtures run submit work that runs language models as a job and return at once (slurm.account, slurm.gpus, and others are optional). Follow the job with txtures status. tx.compute and tx.run in Python submit the same job and wait for its results. Pass --local or local=True to compute here instead.

Run ./install --help for every option and txtures site ls to see the resulting settings. For gated models, run txtures hf login once.

txtures can also be installed with pip or uv as a dependency of other software; see Settings.

Use

Put a file of sentences, one per line, in the inputs directory as gardenpath.txt, then:

txtures run gardenpath

This writes a table with one row per word and its surprisal under GPT-2 to the outputs directory. From Python:

import txtures as tx

table = tx.compute("surprisal", ["The horse raced past the barn fell."])

See the documentation, starting with Getting started.

Development

./install --dev
txtures-install/env/bin/python -m pytest -q

--fast skips the tests that load neural models, for quick runs during development. On a network file system, txtures-install/env/bin/python tests/local.py -q [--fast] runs the suite from a copy of the code and environment on local disk, which is faster; the environment is copied once per host. See Running the tests.

See CONTRIBUTING.md for contribution, attribution, and release rules, and WRITING_POLICY.md for documentation style.

License

GPL-3.0-or-later. See LICENSE.

Metadata

Release files for txtures 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for txtures 0.6.0
File Size Uploaded Provenance Actions
txtures-0.6.0.tar.gz 238.0 kB With provenance Details for txtures-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for txtures 0.6.0
File Interpreter ABI Platform Actions
txtures-0.6.0-py3-none-any.whl Python 3 none any Details for txtures-0.6.0-py3-none-any.whl

Total release size: 439.7 kB

Release files / txtures-0.6.0.tar.gz

Download URL txtures-0.6.0.tar.gz
Size 238.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9f1a263afc2b6ce23ff7d4edea23f99247a6788ccc761b7c5902f10502f6f20c
BLAKE2b-256 checksum
How to use checksums
29942658ae2fb4cd587537bbdf96985d6fb3312b921fcce4bbe1626fd48cb1d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / txtures-0.6.0-py3-none-any.whl

Download URL txtures-0.6.0-py3-none-any.whl
Size 201.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1359ff33957ae1af14b77884f1a4224976cb902d2864ef2502c7a08dfa87b47
BLAKE2b-256 checksum
How to use checksums
b247ae3b2a7b7b5f4e987e4f2d47874b5685e6fc9bf464505a7a6663265a02cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for txtures 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for txtures-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page