Readability Index in Python(NLP)?

Natural language processing is the study of automated generation and understanding of natural human languages. This is becoming more and more interesting tasks to solve, as computer technology is integrated into almost every industry nowadays. We are going to study one specific field within natural language processing; readability. This involves the topic of determining the readability of a text. This indicates how difficult it is to read or understand a text.
A readability index is a numeric value that indicates how difficult (or easy) it is to read and understand a text. There are several different tests for determining readability, and they have different fields of use.
"Readability describes the ease with which a document can be read" [13]. There exist many different tests [9] to calculate readability. Readability tests are "considered to be predictions of reading ease but not the only method for determining readability"
Some of the tests are language neutral, but there are some tests that are more suited for certain languages. Knowledge of the different readability tests is essential for us.
ARI = 4.71 * (characters/words) 
+ 0.5 * (words/sentence) -21.43
Flesch Reading Ease
FRE = 206.835 − 1.015*(total words/ 
total sentences) − 84.6 * (total
syllables/ total words)
FKGL = 0.39 * (total words/ total 
sentences) + 11.8 (total syllables/ 
total words) -15.59
CLI = (5.89 * (characters/ words)) − 
(30 *(sentences/words)) − 15.8
GFI = 0.4 * (( words/ sentence) + 
100 * (complex words/ words))
Find a 100-word sample from your writing.
Find a 100-word sample from your writing.
Calculate the easy words (defined as two syllables or less) and place a number "1" over each word, even including a, an, the, and other simple words.
Calculate the easy words (defined as two syllables or less) and place a number "1" over each word, even including a, an, the, and other simple words.
Calculate the hard words (defined as three syllables or more) and place a number "3" over each word as pronounced by the dictionary.
Calculate the hard words (defined as three syllables or more) and place a number "3" over each word as pronounced by the dictionary.
Multiply the number of easy words times "1."
Multiply the number of easy words times "1."
Multiply the number of hard words times "3."
Multiply the number of hard words times "3."
Add the two previous numbers together.
Add the two previous numbers together.
Divide that total by the number of sentences.
Divide that total by the number of sentences.
RIX = (Long Words/ Sentences)
(long words = words where number of characters > 6)
LIX = (total words/ total sentences) + 
(long words/ total words * 100)
(long words = words where number 
of characters > 6)
For example, below is the program through flesch index to determine the readability of a text file.
From above the flesch-kincaid Grade level formula is used to compute the equivalent Grade level G −
FKGL = 0.39 * (total words/ total sentences) + 11.8 (total syllables/ total words) -15.59
import os
dire = os.getcwd()
listOfdir = os.listdir(dire)
while True:
   UserFileName = input('Enter file name:')
   if (UserFileName in listOfdir) and (UserFileName.endswith(".txt")):
      InputFile = open(UserFileName,'r')
      text = InputFile.read()
      sentence = text.count('.') + text.count('!') + text.count(';') + text.count(':') + text.count('?')
      words = len(text.split())
      syllable = 0
      for word in text.split():
         for vowel in ['a','e','i','o','u']:
            syllable + = word.count(vowel)
         for ending in ['es','ed','e']:
            if word.endswith(ending):
               syllable - = 1
         if word.endswith('le'):
            syllable + = 1
      G = round((0.39*words)/sentence+ (11.8*syllable)/words-15.59)
      if G > = 0 and G < = 30:
         print ('The Readability level is College')
      elif G > = 50 and G < = 60:
         print ('The Readability level is High School')
      elif G > = 90 and G < = 100:
         print ('The Readability level is fourth grade')
      print ('This text has %d words' %(words))
   elif UserFileName not in listOfdir:
      print ('This text file does not exist in current directory')
   elif not(UserFileName.endswith('.txt')):
      print ('This is not a text file.')
Enter file name:dataVisualization.txt
The Readability level is College
This text has 64 words