Metadata-Version: 2.1
Name: pystylometry
Version: 1.4.3
Summary: Comprehensive Python package for stylometric analysis
License: MIT
Keywords: stylometry,nlp,text-analysis,authorship,readability,lexical-diversity,readability-metrics
Author: Craig Trim
Author-email: craigtrim@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Typing :: Typed
Provides-Extra: all
Provides-Extra: excel
Provides-Extra: lexical
Provides-Extra: readability
Provides-Extra: syntactic
Provides-Extra: viz
Requires-Dist: bnc-lookup (>=1.4.3) ; extra == "lexical" or extra == "all"
Requires-Dist: gngram-lookup (>=0.2.5) ; extra == "lexical" or extra == "all"
Requires-Dist: matplotlib (>=3.8.0,<4.0.0) ; extra == "viz" or extra == "all"
Requires-Dist: openpyxl (>=3.1.0,<4.0.0) ; extra == "lexical" or extra == "excel" or extra == "all"
Requires-Dist: pronouncing (>=0.2.0,<0.3.0) ; extra == "readability" or extra == "all"
Requires-Dist: rich (>=13.0,<14.0)
Requires-Dist: seaborn (>=0.13.0,<0.14.0) ; extra == "viz" or extra == "all"
Requires-Dist: spacy (>=3.8.0,<4.0.0) ; extra == "readability" or extra == "syntactic" or extra == "all"
Requires-Dist: wordnet-lookup (>=1.2.4) ; extra == "lexical" or extra == "all"
Project-URL: Homepage, https://github.com/craigtrim/pystylometry
Project-URL: Issues, https://github.com/craigtrim/pystylometry/issues
Project-URL: Repository, https://github.com/craigtrim/pystylometry
Description-Content-Type: text/markdown

# pystylometry

[![PyPI version](https://badge.fury.io/py/pystylometry.svg)](https://badge.fury.io/py/pystylometry)
[![Downloads](https://static.pepy.tech/badge/pystylometry)](https://pepy.tech/project/pystylometry)
[![Downloads/Month](https://static.pepy.tech/badge/pystylometry/month)](https://pepy.tech/project/pystylometry)
[![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Tests](https://img.shields.io/badge/tests-1022%20passed-brightgreen)]()

Stylometric analysis and authorship attribution for Python. 50+ metrics across 11 modules, from vocabulary diversity to AI-generation detection.

## Install

```bash
pip install pystylometry              # Core (lexical metrics)
pip install pystylometry[all]         # Everything
```

## Modules

| Module | Metrics | Description |
|--------|---------|-------------|
| [**lexical**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/lexical) | TTR, MTLD, Yule's K/I, Hapax, MATTR, VocD-D, HD-D, MSTTR, function words, word frequency | Vocabulary diversity and richness |
| [**readability**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/readability) | Flesch, Flesch-Kincaid, SMOG, Gunning Fog, Coleman-Liau, ARI, Dale-Chall, Fry, FORCAST, Linsear Write, Powers-Sumner-Kearl | Grade-level and difficulty scoring |
| [**syntactic**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/syntactic) | POS ratios, sentence types, parse tree depth, clausal density, passive voice, T-units, dependency distance | Sentence and parse structure (requires spaCy) |
| [**authorship**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/authorship) | Burrows' Delta, Cosine Delta, Zeta, Kilgarriff chi-squared, MinMax, John's Delta, NCD | Author attribution and text comparison |
| [**stylistic**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/stylistic) | Contractions, hedges, intensifiers, modals, punctuation, vocabulary overlap (Jaccard/Dice/Cosine/KL), cohesion, genre/register | Style markers and text similarity |
| [**character**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/character) | Letter frequencies, digit/uppercase ratios, special characters, whitespace | Character-level fingerprinting |
| [**ngrams**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/ngrams) | Word/character/POS n-grams, Shannon entropy, skipgrams | N-gram profiles and entropy |
| [**dialect**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/dialect) | British/American classification, spelling/grammar/vocabulary markers, markedness | Regional dialect detection |
| [**consistency**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/consistency) | Sliding-window chi-squared drift, pattern classification | Intra-document style analysis |
| [**prosody**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/prosody) | Syllable stress, rhythm regularity | Prose rhythm (requires spaCy) |
| [**viz**](https://github.com/craigtrim/pystylometry/tree/master/pystylometry/viz) | Timeline, scatter, report (PNG + interactive HTML) | Drift detection visualization |

## Development

```bash
git clone https://github.com/craigtrim/pystylometry && cd pystylometry
pip install -e ".[dev,all]"
make test       # 1022 tests
make lint       # ruff + mypy
make all        # lint + test + build
```

## License

MIT

## Author

Craig Trim -- craigtrim@gmail.com

