Description
Flesch Reading Ease, a readability test named after its deviser Rudolf Flesch, is among most ubiquitously used readability tests, which are principally employed for assessment of the difficulty to understand a reading passage written in English. The Flesch Reading Ease score of a passage relies solely on three statistics, namely the total numbers of sentences, words and syllables, of the passage. Specifically, the score is defined by the following formula:
.
As can be inferred from the above formula, a passage with a high Flesch Reading Ease score tends to favor shorter sentences and words, which is in compliance with commonsense in spite of partial accuracy. (Think of, for instance, the word "television". Long as it may seem, it is indeed one of the first words that any individual who studies English learns.) A related Wikipedia entry on Flesch Reading Ease [1] suggests that passages scoring 90~100 are comprehensible for an average American 5th grader, and 8th and 9th graders possess the ability to follow passages with a score in the range of 60~70, whereas passages not exceeding 30 in the score are best suitable for college graduates. The text of this problem, all sections taken into account, scores roughly 50 as per the calculation of Google Documents.
Despite the simplicity in its ideas, several aspects of its definition remains vague for any real-world implementation of Flesch Reading Ease. For the sake of precision and uniformity, the following restrictions adapted from [2] are adopted for this problem, to which you are to write a solution that effectively computes the Flesch Reading Ease score of a given passage of English text.
- Periods, explanation points, colons and semicolons serve as sentence delimiters.
- Each group of continuous non-blank characters with beginning and ending punctuation removed counts as a word.
- Each vowel (one of a, e, i, o, u and y) in a word is considered one syllable subject to that
- -es, -ed and -e (except -le) endings are ignored,
- words of three letters or shorter count as single syllables,
- consecutive vowels count as one syllable.
References
- Wikipedia contributors. Flesch-Kincaid Readability Test. Wikipedia, The Free Encyclopedia. August 30, 2007, 01:57 UTC. Available at:http://en.wikipedia.org/w
/index.php?title=Flesch -Kincaid_Readability_Test &oldid=154509512. Accessed September 5, 2007. - Talburt, J. 1985. The Flesch index: An easily programmable readability analysis algorithm. In Proceedings of the 4th Annual international Conference on Systems Documentation. SIGDOC '85. ACM Press, New York, NY, 114-122.
Input
Output
Sample Input
Flesch Reading Ease, a readability test named after its deviser Rudolf Flesch, is among most ubiquitously used readability tests, which are principally employed for assessment of the difficulty to understand a reading passage written in English. The Flesch Reading Ease score of a passage relies solely on three statistics, namely the total numbers of sentences, words and syllables, of the passage.
Sample Output
26.09
题目本身难度不大,但是在具体判断时会有点绕
#include <cstdio>
#include <cstring>
int main(void)
{
char sq[1000];
double wrd = 0,stc = 0,vow = 0;//分别计数的是单词数,句子数,音节数
int i,n,k,l,p;
while(scanf("%s",sq) != EOF)//使用逐个输入记录
{
wrd++; double q = 0;//q用来记录这一段输入完成后,音节数应当增加多少
k = strlen(sq) ;
p = k;l = 0;
n = 0;
if( sq[k - 1] == 'e' &&sq[k - 2] != 'l')
sq[k - 1] = '#';
if( sq[k - 2] == 'e'&&(sq[k - 1] == 's'||sq[ k - 1] == 'd'))
sq[k - 2] = '#';
for(i = 0; i <= k; i++)
{
l++;
if(i == k||sq[i] == '.'||sq[i] == ':'||sq[i] == ','||
sq[i] == ';'||sq[i] == '?'||sq[i] == '!')
{
if(i < k&&sq[i] != ',') stc++;//需要注意的是因为是scanf输入,不是一定是每个单词输入,而是有可能出现 qqq.php.的情况,所以需要判断是否出现分隔
if(i < k - 1) wrd++;
if( l <= 4)
{
q = 1;l = 0;n = 0;
continue;
}
if( sq[i - 1] == 'e' &&sq[i - 2] != 'l')
sq[i - 1] = '#',q--;
if( sq[i - 2] == 'e'&&(sq[i - 1] == 's'||sq[ i - 1] == 'd'))
sq[i - 2] = '#',q--;
}
if( sq[i] == 'a'|| sq[i] == 'e'|| sq[i] == 'i'||
sq[i] == 'o'|| sq[i] == 'u'|| sq[i] == 'y'||
sq[i] == 'A'|| sq[i] == 'E'|| sq[i] == 'I'||
sq[i] == 'O'|| sq[i] == 'U'|| sq[i] == 'Y')
{
q++;n++;
if(n >=2) q = q-n+1;
else continue ;
}
n = 0;
}
vow += q;
}
printf("%.2f\n", 206.835-1.015*wrd/stc-84.6*vow/wrd);
}