Test Content Readability from a Text File

readable.png

If you recall I showed how to test the readability of some written content using Python.

In the comments, I was asked if it would be possible to read a text file rather than provide a URL.

Well, here is the code to do that :)

Code:

https://gist.github.com/omiq/e3722435dd9cb3b719f33f3970edda4b

# this is the important library that acutally does the work
from textstat.textstat import textstat

with open('testfile.txt', 'r') as content_file:
    test_string = content_file.read()

# show what we grabbed
print( test_string )
print()

# So how readable is it?
print( str(textstat.flesch_reading_ease(test_string)) + " /100" )

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center