Pelican plugin that calculates post statistics such as word count, reading ease, and more.
Project description
Statistics: A Plugin for Pelican
Statistics is a Pelican plugin that calculates post statistics such as word count, reading ease, and more.
Installation
This plugin can be installed via:
python -m pip install pelican-statistics
As long as you have not explicitly added a PLUGINS setting to your Pelican settings file, then the newly-installed plugin should be automatically detected and enabled. Otherwise, you must add statistics to your existing PLUGINS list. For more information, please see the How to Use Plugins documentation.
Usage
This plugin calculates various statistics about a post and stores them in an article.statistics dictionary:
wc: the number of words in the articleread_mins: how many minutes it would take to read this article, based on 250 WPMword_counts: frequency count of all the words in the article — can be used for tag/word cloudsfi: Flesch Reading Easefk: Flesch–Kincaid Grade Level
article.statistics dictionary example:
{
'wc': 2760,
'fi': '65.94',
'fk': '7.65',
'word_counts': Counter({"to": 98, "a": 90, "the": 83, "of": 50, ...}),
'read_mins': 12
}
This article.statistics dictionary allows you to output these values in your templates. For example:
<p title="~{{ article.statistics['wc'] }} words">~{{ article.statistics['read_mins'] }} min read</p>
<ul>
<li>Flesch Reading Ease: {{ article.statistics['fi'] }}</li>
<li>Flesch–Kincaid Grade Level: {{ article.statistics['fk'] }}</li>
</ul>
The word_counts variable is a python Counter dictionary and looks something like the following, with each unique word and its frequency:
Counter({"to": 98, "a": 90, "the": 83, "of": 50, "karma": 50, .....
This word_counts variable can be used to create a tag/word cloud for a post.
Contributing
Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.
To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.
License
This project is licensed under the AGPL-3.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pelican_statistics-1.0.0.tar.gz.
File metadata
- Download URL: pelican_statistics-1.0.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.2 CPython/3.11.11 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9d20b262bb8e9af975c68fb73169fd9d588f26ff340260387ec4dc81f2d13b0
|
|
| MD5 |
c8650d77a406593a8e2e7a8d714ce55a
|
|
| BLAKE2b-256 |
5eb5ff348ea371553423afd666bc6544509b6b4ed267f77887972088cac0109f
|
File details
Details for the file pelican_statistics-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pelican_statistics-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.2 CPython/3.11.11 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2397fc1cee0731e65057d755c5aa8811d075b20c11b2bdc07a88ea7b7dc40e1
|
|
| MD5 |
aed4762450aaa3d4df810e9b7adc8cdb
|
|
| BLAKE2b-256 |
8994cea69c4042022106cf9ae93c6d1af32770bf8f154903d09a63d305f01043
|