Skip to content

Commit 74fb20b

Browse files
committed
Add Readability
1 parent 7fa483c commit 74fb20b

File tree

14 files changed

+146
-0
lines changed

14 files changed

+146
-0
lines changed

pkg/Readability/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Readability
2+
3+
This repository contains a [Vale-compatible][1] implementation of many popular
4+
"readability" metrics.
5+
6+
## Getting Started
7+
8+
> :exclamation: Readability requires Vale >= **2.13.0**. :exclamation:
9+
10+
Download the [latest release][2], copy the "Readability" directory to your
11+
`StylesPath`, and include it in your configuration file:
12+
13+
```ini
14+
# This goes in a file named either `.vale.ini` or `_vale.ini`.
15+
StylesPath = path/to/some/directory
16+
MinAlertLevel = warning # suggestion, warning or error
17+
18+
# Only Markdown and .txt files; change to whatever you're using.
19+
[*.{md,txt}]
20+
# List of styles to load.
21+
BasedOnStyles = Readability
22+
```
23+
24+
See [Usage][3] for more information.
25+
26+
[1]: https://github.com/errata-ai/vale
27+
[2]: https://github.com/errata-ai/readability/releases
28+
[3]: https://github.com/errata-ai/vale/#usage
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: metric
2+
message: "Try to keep the Automated Readability Index (%s) below 8."
3+
link: https://en.wikipedia.org/wiki/Automated_readability_index
4+
5+
formula: |
6+
(4.71 * (characters / words)) + (0.5 * (words / sentences)) - 21.43
7+
8+
condition: "> 8"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: metric
2+
message: "Try to keep the Coleman–Liau Index grade (%s) below 9."
3+
link: https://en.wikipedia.org/wiki/Coleman%E2%80%93Liau_index
4+
5+
formula: |
6+
(0.0588 * (characters / words) * 100) - (0.296 * (sentences / words) * 100) - 15.8
7+
8+
condition: "> 9"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: metric
2+
message: "Try to keep the Flesch–Kincaid grade level (%s) below 8."
3+
link: https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests
4+
5+
formula: |
6+
(0.39 * (words / sentences)) + (11.8 * (syllables / words)) - 15.59
7+
8+
condition: "> 8"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: metric
2+
message: "Try to keep the Flesch reading ease score (%s) above 70."
3+
link: https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests
4+
5+
formula: |
6+
206.835 - (1.015 * (words / sentences)) - (84.6 * (syllables / words))
7+
8+
condition: "< 70"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: metric
2+
message: "Try to keep the Gunning-Fog index (%s) below 10."
3+
link: https://en.wikipedia.org/wiki/Gunning_fog_index
4+
5+
formula: |
6+
0.4 * ((words / sentences) + 100 * (complex_words / words))
7+
8+
condition: "> 10"

pkg/Readability/Readability/LIX.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
extends: metric
2+
message: "Try to keep the LIX score (%s) below 35."
3+
4+
link: https://en.wikipedia.org/wiki/Lix_(readability_test)
5+
# Very Easy: 20 - 25
6+
#
7+
# Easy: 30 - 35
8+
#
9+
# Medium: 40 - 45
10+
#
11+
# Difficult: 50 - 55
12+
#
13+
# Very Difficult: 60+
14+
formula: |
15+
(words / sentences) + ((long_words * 100) / words)
16+
17+
condition: "> 35"

pkg/Readability/Readability/SMOG.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: metric
2+
message: "Try to keep the SMOG grade (%s) below 10."
3+
link: https://en.wikipedia.org/wiki/SMOG
4+
5+
formula: |
6+
1.0430 * math.sqrt((polysyllabic_words * 30.0) / sentences) + 3.1291
7+
8+
condition: "> 10"

pkg/Readability/Readability/meta.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"feed": "https://github.com/errata-ai/Readability/releases.atom",
3+
"vale_version": ">=2.13.0"
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
StylesPath = ../../
2+
3+
MinAlertLevel = suggestion
4+
5+
[*.md]
6+
Readability.ColemanLiau = YES

0 commit comments

Comments
 (0)