Skip to content

Instantly share code, notes, and snippets.

@malloc47 malloc47/man-flesch
Created Oct 25, 2011

Embed
What would you like to do?
Flesch–Kincaid Index For *nix Man Pages
# prepossess: remove newlines, add newlines after end of sentences, trim whitespace, and remove short lines
man /usr/share/man/man1/git.1.gz | tr '\n' ' ' | sed 's/\./\.\n/g' | sed -e 's/^[ \t]*//' | sed '/.\{3\}/!d'
> man /usr/share/man/man1/git.1.gz | style
readability grades:
Kincaid: 7.0
ARI: 4.4
Coleman-Liau: 4.0
...
> awk '{avg+=$2} END {print avg/NR}' ~/flesch-kincaid
9.08134
> awk '{sum+=$2; sumsq+=$2*$2} END {print sqrt(sumsq/NR - (sum/NR)**2)}' ~/flesch-kincaid
10.3857
man /usr/share/man/man1/git.1.gz | style | grep Kincaid | awk '{print $2}'
for i in `ls -d -1 /usr/share/man/man?/*` ; do echo -n "$i " ; man $i | tr '\n' ' ' | sed 's/\./\.\n/g' | sed -e 's/^[ \t]*//' | sed '/.\{3\}/!d' | grep Kincaid | awk '{print $2}' ; done > ~/flesch-kincaid
grep `awk '$2>m{m=$2}END{print m}' ~/flesch-kincaid` ~/flesch-kincaid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.