A lightweight Wagtail plugin to determine the reading level of text input into a rich text field.
Currently there are two available modes:
- (Default) Reading Age - calculated using the Automated Readability Index.
- SMOG Index - calculated the SMOG Index (only suitable for English).
- Coleman-Liau Index - calculated using the Coleman-Liau Index.
- Flesch Score - calculated using the Flesch Reading Ease forumal (only suitable for English).
- Gunning Fog Index - calculated using the Gunning Fog Index
- Wagtail >= 5.2
- Django >= 4.2
if you need to use this package on an earlier Wagtail version than 5.1, you can use the PyPi 3.5.0 release: https://pypi.org/project/wagtail-readinglevel/3.5.0/
The package is intended to be installed from Github, not PyPi. To install:
Add the following to your requirements.txt
file:
-e git+https://github.com/torchbox-forks/wagtail-readinglevel.git@master#egg=wagtail-readinglevel
or if you are using poetry Run
poetry add git+https://github.com/torchbox-forks/wagtail-readinglevel.git@master#egg=wagtail-readinglevel
Add the desired plugin app names to your list of installed apps AFTER all wagtail app includes (e.g. wagtail.admin, wagtail.core etc.).
The names are:
wagtailreadinglevel
for Automated Readability Index (Reading Age)wagtailreadinglevelsmog
for SMOG Indexwagtailreadinglevelcoleman
for Coleman-Liau Indexwagtailreadinglevelflesch
for Flesh Reading Ease Scorewagtailreadinglevelfog
for the Gunning Fog index
The plugin will show results for any rich text fields which don't use a limited features
list.
For feature-limited fields, you'll need to add their names to that list. The names are:
readinglevel
for Automated Readability Index (Reading Age)readinglevelsmog
for SMOG Indexreadinglevelcoleman
for Coleman-Liau Indexreadinglevelflesch
for Flesch Reading Ease Scorereadinglevelfog
for the Gunning Fog index
Once installed You will see the reading level and/or smog index displayed under all rich text fields in your Wagtail admin area (depending on which you added to your list of installed apps).
The original author of this plugin has no plans to continue development.
Torchbox will continue to maintain this package here for the foreseeable future. We won't be releasing the package on PyPi but will be managing releases via Github. If you would like to contribute, please feel free to submit a pull request.
Set up a virtualenv:
python3 -m venv venv
Activate the virtualenv:
source venv/bin/activate
Install the dependencies:
pip install -e .
There is a basic testing app available in the testapp
directory change to that directory and run the following commands:
./manage.py migrate
./manage.py createsuperuser
./manage.py runserver
You can use the the richext fields in the test app to test the plugin.
The javascript helpers are built using webpack and can be found the src directory. To build the assets run the following command from the root of the project:
nvm use && npm install
Then you can run the following command to build the assets:
npm run build
This will compile the sources and place the output in the following respective directories:
wagtailreadinglevel/static
wagtailreadinglevelsmog/static
wagtailreadinglevelcoleman/static
wagtailreadinglevelflesch/static
wagtailreadinglevelfog/static
The javascript file are loaded by each wagtail_hook. The hooks are defined in the wagtail_hooks.py
file in each app.