Skip to main content

Comprehensive Python package for stylometric analysis

Project description

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

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

pystylometry-1.3.6.tar.gz (233.6 kB view details)

Uploaded Source

Built Distribution

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

pystylometry-1.3.6-py3-none-any.whl (275.2 kB view details)

Uploaded Python 3

File details

Details for the file pystylometry-1.3.6.tar.gz.

File metadata

  • Download URL: pystylometry-1.3.6.tar.gz
  • Upload date:
  • Size: 233.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Darwin/24.6.0

File hashes

Hashes for pystylometry-1.3.6.tar.gz
Algorithm Hash digest
SHA256 b975dc1886bd2e986cd2e48f0192b71905f9b93dc2f95bceee8d9c0c92201a76
MD5 761157f731e930b98eb4597b00782c0a
BLAKE2b-256 5a6239d39085fc1c182da7ed4184a95cd9f2cd9b8bba0a49f122012ca4f6a8fd

See more details on using hashes here.

File details

Details for the file pystylometry-1.3.6-py3-none-any.whl.

File metadata

  • Download URL: pystylometry-1.3.6-py3-none-any.whl
  • Upload date:
  • Size: 275.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Darwin/24.6.0

File hashes

Hashes for pystylometry-1.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 39b73fbf63d4471e91770b95b728aea2fc6235a9d4c84637ac84baa1bc6be7d2
MD5 c31c6dc12eff542a368e6db4c2578a34
BLAKE2b-256 462ee3779a177fc6b9f9fc2b74c5298c83cc6367b47e85eaf2be2537920e934a

See more details on using hashes here.

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