Skip to content

Instantly share code, notes, and snippets.

@yjzhang
Created June 4, 2021 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yjzhang/dc321067dacbe9d1120b1a2760e9bc69 to your computer and use it in GitHub Desktop.
Save yjzhang/dc321067dacbe9d1120b1a2760e9bc69 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
import textstat
path = 'scripted_test_outputs/000_output.txt'
if len(sys.argv) > 1:
path = sys.argv[1]
print(path)
with open(path) as f:
text = f.read()
print('flesch_reading_ease:', textstat.flesch_reading_ease(text))
print('flesch_kincaid:', textstat.flesch_kincaid_grade(text))
print('gunning_fog:', textstat.gunning_fog(text))
print('smog:', textstat.smog_index(text))
print('ari:', textstat.automated_readability_index(text))
print('coleman_liau:', textstat.coleman_liau_index(text))
print('linsear:', textstat.linsear_write_formula(text))
print('dale_chall:', textstat.dale_chall_readability_score(text))
score = textstat.text_standard(text, float_output=True)
print('consensus score:', score)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment