Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 2253 | Accepted: 703 |
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
给出一篇规范的文章,求其 句子数、单词数 和 音节数
把这3个值代入题目给出的公式,输出其结果,保留2位小数。
PS:“规范”即文章没有错误的标点符号,字母在适当的位置有大小写。
标记单词分隔符: 逗号(,) 和 空格( )
句子分隔符:句号(.) 问号(?) 冒号(:) 分号(;) 感叹号(!)
最后注意一下把-ed,-es和-e(-le除外)去掉就可以了。
#include<stdio.h>
#include<string.h>
int judge(char ch)
{
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='y')
return 1;
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='Y')
return 1;
return 0;
}
int main()
{
char s[10000];
int n,m,i;
int word = 0;
int se = 0;
int syl = 0;
while(scanf("%s",s)!=EOF)
{
word++;
int len = strlen(s);
if(s[len-1]=='.'||s[len-1]=='!'||s[len-1]=='?'||s[len-1]==';'||s[len-1]==':')
se++;
for(i=len-1; !((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z')); --i);
s[i+1]='\0';
if(strlen(s)<=3)
syl++;
else
{
len=strlen(s);
for(i=0; i<len; i++)
{
if((i==0&&judge(s[i]))||(i>0&&judge(s[i])&&!judge(s[i-1])))
{
syl++;
}
}
if(!judge(s[len-3]))
{
if(s[len-2]=='e'&&(s[len-1]=='d'||s[len-1]=='s'))
{
syl--;
}
}
if(!judge(s[len-2]))
{
if(s[len-2]!='l'&&s[len-1]=='e')
syl--;
}
}
}
//printf("%d\n%d\n%d\n",word,se,syl);
printf("%.2f\n",206.835-1.015*(word*1.0/se) - 84.6*(syl*1.0/word));
return 0;
}