Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

The Lexos Python Library

GitHub release (latest SemVer) Python 3.12 Python wheels Code style: ruff license Coverage

The Lexos Python library reproduces and extends most of the text analysis tools in the Lexos web app. Lexos is designed to implement many common text analysis procedures in a way that saves the user having to re-invent the wheel or figure out how to combine multiple Python packages to achieve a given result. It is intended to be used as a library in other projects to build backend functions for applications, but it can be used in standalone scripts or in Jupyter notebooks. As with the original web app, it is designed to accessible to entry-level users whilst offering power functionality for students and researchers, particularly in the Humanities. It is also designed to be as language-agnostic as possible so that it can be used for a wide variety of historical and under-resourced languages.

📖 Documentation

A full discussion of the use of the API can be found on the website Documentation website.

⭐️ Major Features

  • Loads texts from a variety of sources into a common data structure.
  • Manages a corpus of texts and generates stastics about the corpus.
  • Performs text pre-processing ("scrubbing") and splitting ("cutting").
  • Performs tokenization and trains language models using spaCy.
  • Creates assorted visualizations of term vectors.
  • Performs hierarchical and kmeans clustering with a variety of visualizations for text comparisons..
  • Performs classification using spaCy, scikit-learn, and custom architectures.
  • Generates topic models and topic model visualizations using MALLET and DFR Browser 2.

And more!

What's New in v0.2.0b

  • Performance optimizations and bug fixes througout.
  • A simplified public API.
  • Better HTML and XML tag handling in Scrubber.
  • New and improved clustering visualizations.
  • Improved plotting functions in Bootstrap Consensus clustering.
  • Silhouette score analysis for KMeans clustering.
  • More advanced topic modelling features, including termite plots, customisable labels, and LLM-generated labels with local or cloud-based models.
  • A new Classification module that performs text classification using a variety of architectures.
  • A new Structural Stylometry module that allows you to assess the significance of punctuation and whitespace patterns in your documentation.
  • Language model training features.
  • Improved documentation and tutorials for new users (now in a separate lexos-docs repository).

⏳ Installation

pip install lexos

To update to the latest version, use

pip install -U lexos

Or, if you are using uv:

uv add lexos

Lexos uses spaCy language models to obtain language-specific information about texts. By default, it comes with spaCy's multi-language model xx_sent_ud_sm and its small English-language en_core_web_sm.

If you are working in another language or need a larger language model, you can download instructions for additional models from the spaCy models page. Use the following command:

python -m spacy download en_core_web_md # Replace with the name of your model

🚦Project Status

The Lexos API is currently in beta. Most of the core functionality of the Lexos web app, along with new features, has been implemented and documented. As of September 2026, the API is considered feature complete and stable for general use, but some rough edges remain. Feedback is welcome.

I will continue to fix bugs and improve the documentation as issues arise, but no major new features are planned at this time. The beta release coincides with at a time when the landscape of digital tools is rapidly evolving and AI-assisted coding is becoming more prevalent. I am waiting to see whether there is significant adoption of the Lexos library before investing more time in developing new features. If you like Lexos, you can help by requesting new features in the GitHub issues (labelled as "enhancement") or contributing them yourself.

💝 Contribute

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📝 Citation Information

Kleinman, S., (2026). Lexos. v0.2.0b1 https://github.com/scottkleinman/lexos. 10.5281/zenodo.18112379.

Download files

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

Source Distribution

lexos-0.2.0b1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

lexos-0.2.0b1-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file lexos-0.2.0b1.tar.gz.

File metadata

  • Download URL: lexos-0.2.0b1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lexos-0.2.0b1.tar.gz
Algorithm Hash digest
SHA256 b9500a352ef70b5cb077e756ca84f8a68136f2ae1a0e4cfd1e1e05a06ab743dd
MD5 e9ec7046aa21ccfa07548c92ea18b60f
BLAKE2b-256 d58027f86df7ecef01291474641dc60b87295b9b06bfdc7f7285d93e79aa4b89

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexos-0.2.0b1.tar.gz:

Publisher: release.yml on scottkleinman/lexos

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

File details

Details for the file lexos-0.2.0b1-py3-none-any.whl.

File metadata

  • Download URL: lexos-0.2.0b1-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lexos-0.2.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6e4ea226b6a0661af0b030467aec4551362008131c90eb9139c5ee41f87721a
MD5 b530609a153fe07328df2c9a0d299021
BLAKE2b-256 21b35eb1a54c2323bcd35d6504a5fec3ac1e93d24e39b36b12edda95826f57bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexos-0.2.0b1-py3-none-any.whl:

Publisher: release.yml on scottkleinman/lexos

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

Release history Release notifications | RSS feed

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

This release

0.2.0b1 This release

2 files

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