Skip to content

Instantly share code, notes, and snippets.

@YiLi225
Last active May 6, 2022 14:34
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 YiLi225/9d2d9b593158ac19e4256cd8d33684d4 to your computer and use it in GitHub Desktop.
Save YiLi225/9d2d9b593158ac19e4256cd8d33684d4 to your computer and use it in GitHub Desktop.
### Install: !pip install textstate
import textstat
# curText = doc_set[27310]
# (1) Flesch readability score
print(textstat.flesch_reading_ease(curText))
68.94 ## indicating Standard
# (2) Reading time, assuming 15 ms/character
print(textstat.reading_time(curText, ms_per_char=15))
3.8 ## 3.8s to read
# (3) Grade level: Intended for text written for children up to grade four
print(textstat.spache_readability(curText))
5.81
# (4) Word count
print(textstat.lexicon_count(curText, removepunct=True))
55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment