Skip to main content

pystylometry

PyPI version Downloads Downloads/Month Python 3.9+ License: MIT Tests

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

Install

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

Modules

Module Metrics Description
lexical TTR, MTLD, Yule's K/I, Hapax, MATTR, VocD-D, HD-D, MSTTR, function words, word frequency Vocabulary diversity and richness
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 POS ratios, sentence types, parse tree depth, clausal density, passive voice, T-units, dependency distance Sentence and parse structure (requires spaCy)
authorship Burrows' Delta, Cosine Delta, Zeta, Kilgarriff chi-squared, MinMax, John's Delta, NCD Author attribution and text comparison
stylistic Contractions, hedges, intensifiers, modals, punctuation, vocabulary overlap (Jaccard/Dice/Cosine/KL), cohesion, genre/register Style markers and text similarity
character Letter frequencies, digit/uppercase ratios, special characters, whitespace Character-level fingerprinting
ngrams Word/character/POS n-grams, Shannon entropy, skipgrams N-gram profiles and entropy
dialect British/American classification, spelling/grammar/vocabulary markers, markedness Regional dialect detection
consistency Sliding-window chi-squared drift, pattern classification Intra-document style analysis
prosody Syllable stress, rhythm regularity Prose rhythm (requires spaCy)
viz Timeline, scatter, report (PNG + interactive HTML) Drift detection visualization

Development

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

Metadata

Release files for pystylometry 1.4.3

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

Source distribution (sdist)

Source distribution for pystylometry 1.4.3
File Size Uploaded
pystylometry-1.4.3.tar.gz 243.9 kB Details

Built distribution (wheel)

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

Total release size: 529.7 kB

Release files / pystylometry-1.4.3.tar.gz

Download URL pystylometry-1.4.3.tar.gz
Size 243.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e8d4694a2f549e0996b0476a0a6525b6c44ebd249d9cba760aad1aad6fd73641
BLAKE2b-256 checksum
How to use checksums
fe51b30b0217284491261e3309eb01c102ac066911c709f6579f9a0d761ff42b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.9 Darwin/24.6.0

Release files / pystylometry-1.4.3-py3-none-any.whl

Download URL pystylometry-1.4.3-py3-none-any.whl
Size 285.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
600ce1ced5edad206ee1b48e7111034b2a83982f54544136fc81d1b936e12991
BLAKE2b-256 checksum
How to use checksums
490fc98be8a269f1accd375abc2ef58c1d8e5216d7110d3a4b28658634bb0abf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.9 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

1.4.3 This release

2 release files

1.4.0

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.0

2 release 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