poj 3371 Flesch Reading Ease
来源:互联网 发布:校园网络的设计思路 编辑:程序博客网 时间:2024/05/22 13:40
Flesch Reading EaseTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2214 Accepted: 689Description
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
The input contains a passage in English whose Flesch Reading Ease score is to be computed. Only letters of the English alphabet (both lowercase and uppercase), common punctuation marks (periods, question and exclamation marks, colons, semicolons as well as commas, quotation marks, hyphens and apostrophes), and spaces appear in the passage. The passage is of indefinite length and possibly occupies multiple lines. Additionally, it is guaranteed to be correct in punctuation.
Output
Output the Flesch Reading Ease score of the given passage rounded to two digits beyond decimal point.
Sample Input
Flesch Reading Ease, a readability test named after its deviser Rudolf Flesch,is among most ubiquitously used readability tests, which are principallyemployed for assessment of the difficulty to understand a reading passagewritten in English. The Flesch Reading Ease score of a passage relies solelyon three statistics, namely the total numbers of sentences, words andsyllables, of the passage.
Sample Output
26.09
Source
POJ Monthly--2007.09.09, frkstyc
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.
提示
36.62
105.26
示例程序
Source CodeProblem: 3371Code Length: 2250BMemory: 348KTime: 0MSLanguage: GCCResult: Accepted#include <stdio.h>#include <string.h>int symbol(char c){ if(c==' '||c==','||c==':'||c=='.'||c==';'||c=='!'||c=='?'||c=='\0')//分隔符判定('\0'也算) { return 1; } else { return 0; }}int main(){ int i,len,flag,m; double sentance=0,word=0,syllable=0; char ch[1001]; while(gets(ch)!=NULL)//EOF做结束(gets用NULL) { len=0;//单词长度 flag=0;//是否是连续元音字母 m=0;//单词中音节数 for(i=0;ch[i]!='\0';i++) { if(symbol(ch[i])==1)//分隔符判定 { if(len==0)//多个空格的情况 { continue; } word++;//单词数+1 if(ch[i]!=' '&&ch[i]!=',')//句子分隔符判定 { sentance++;//句子数+1 } if(len<=3)//单词长度小于等于3 { syllable++; } else { syllable=syllable+m; } len=0; flag=0; m=0; } else { if(ch[i]<='Z'&&ch[i]>='A')//大写转化小写 { ch[i]=ch[i]+32; } len++; if(ch[i]=='a'||ch[i]=='e'||ch[i]=='i'||ch[i]=='o'||ch[i]=='u'||ch[i]=='y') { if(flag==1)//连续元音字符的情况 { continue; } if(ch[i]=='e') { if(symbol(ch[i+1])==1&&ch[i-1]!='l')//-e且非-le的情况 { continue; } else if((ch[i+1]=='s'||ch[i+1]=='d')&&symbol(ch[i+2])==1)//-ed,-es的情况 { continue; } } m++;//单词中音节数+1 flag=1;//连续元音字符记录 } else { flag=0;//取消连续元音字符记录 } } } if(len!=0)//该行结尾没有分割符,还有最后一个单词没有统计(可以利用'\0'来代替) { word++; if(len<=3) { syllable++; } else { syllable=syllable+m; } } } printf("%.2f",206.835-1.015*(word/sentance)-84.6*(syllable/word)); return 0;}
- POJ 3371 Flesch Reading Ease
- POJ 3371 Flesch Reading Ease
- POJ 3371 Flesch Reading Ease
- POJ 3371 Flesch Reading Ease
- poj 3371 Flesch Reading Ease
- 【POJ 3371】Flesch Reading Ease
- poj 3371 Flesch Reading Ease
- poj-3371-Flesch Reading Ease
- POJ 3371:Flesch Reading Ease 模拟
- 【POJ 3371】 Flesch Reading Ease(模拟)
- Flesch Reading Ease poj 3371 模拟
- POJ 3371 Flesch Reading Ease 可能会
- POJ 3371 Flesch Reading Ease (模拟题)
- POJ-3371-Flesch Reading Ease一道模拟题
- Flesch Reading Ease--模拟
- poj3371 Flesch Reading Ease
- Flesch Reading Ease
- Flesch Reading Ease 模拟
- 重载方法
- 2.JNIEnv
- 验证码
- 郭声琨在上海调研反电信网络诈骗工作
- NGINX 配置基础(1)
- poj 3371 Flesch Reading Ease
- NYOJ 士兵杀敌系列
- leetcode 45.Jump Game II
- Linux根据进程名称Kill多个进程
- 长度单位
- svn相关设置
- ByteBuffer的使用
- linux下安装配置opencv开发环境
- tomcat server.xml 详解