This program calculates the Coleman-Liau Index (CLI) of a given text. The Coleman-Liau index is a readability test designed to gauge the understandability of English texts. It is used to estimate the grade level required to understand a text. The formula is based on the number of letters, words, and sentences in the text.
- Calculate Text Statistics: The program analyzes the number of letters, words, and sentences in the provided text.
- Coleman-Liau Index Calculation: Using the calculated text statistics, the program computes the Coleman-Liau index.
- User Input Options: You can input the text either directly or by uploading a
.txt
file.
The program performs the following steps:
- User Input: The user is prompted to choose between entering the text manually or uploading a
.txt
file. - Text Analysis: The program counts the number of letters, words, and sentences.
- CLI Calculation: The Coleman-Liau index is calculated using the formula: CLI = 0.0588 * L - 0.296 * S - 15.8
where:
L
is the average number of letters per 100 words,S
is the average number of sentences per 100 words.
- Readability Rating: The program outputs the readability level based on the Coleman-Liau index.
Text Statistics: Letters: 456 Words: 78 Sentences: 6 Coleman-Liau Index: 8.92
Readability: 9th grade level
- Clone this repository or download the source code.
- Compile the program using a C compiler (e.g., GCC).
- Run the executable and follow the instructions to either enter the text manually or upload a
.txt
file. - View the readability statistics and the Coleman-Liau index.
gcc coleman_liau.c -o coleman_liau
./coleman_liau