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" )
This is great, thanks!
As this version reads from a file, I guess one don't have to import html2text?
And to read the path to the file I want to test I added:
and changed the 'with open' line to
That way its quick and easy to just run
python read.py /path/to/testfile.txt
to check a file.Quick, easy and fun way to check readability before publishing. Who knows, maybe it will improve my writing?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @makerhacks! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Click on any badge to view your own Board of Honor on SteemitBoard.
To support your work, I also upvoted your post!
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit