poj3371--Flesch Reading Ease(模拟)
来源:互联网 发布:淘宝属于跨境电商吗 编辑:程序博客网 时间:2024/06/05 07:54
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. InProceedings 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 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
给出一段标准英语,统计里面的单词数,句子数,音节数,通过公式算出结果。
标准符号 ',' ' ' '.' ';' ':' '!' '?' 全是英语符号 逗号,空格,只分割单词。句号,分号,冒号,叹号,问号,分割句子和单词。
统计字节的时候:
1、单词长度小于等于3是,音节为1
2、大于3是,每个原音字母a,e,i,o,u,y,区分大小写,每个都是一个音节,如果结尾以-e(-le不算),-es,-ed结尾e不被记为一个音节。
#include <cstdio>#include <cstring>#include <algorithm>using namespace std ;char str[1000] ;int a , b , c ;//a单词数,b句子数,c音节数int find1(char ch){ if( ch == ',' || ch == ' ' ) return 1 ; if( ch == '.' || ch == '?' || ch == ':' || ch == ';' || ch == '!' ) return 2 ; if( ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y' ) return 3 ; if( ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U' || ch == 'Y' ) return 3 ; return 0 ;}void solve(int i,int num,int c_num){ if( num <= 3 ) { c++ ; return ; } if( str[i] == 'e' ) { if( str[i-1] == 'l' || find1(str[i-1]) == 3 ) c += c_num ; else c += (c_num-1) ; } else if( (str[i-1] == 'e' && str[i] == 's') || (str[i-1] == 'e' && str[i] == 'd') ) { if( find1(str[i-2]) == 3 ) c += c_num ; else c += (c_num-1) ; } else c += c_num ; return ;}int main(){ int i , l , num , c_num , flag , k ; a = b = c = 0 ; while( scanf("%s", str) != EOF ) { l = strlen(str) ; flag = num = c_num = 0 ;//flag当前字符的前一个字符是不是原音,num当前单词的字母数,c_num单词原音数 for(i = 0 ; i < l ; i++) { k = find1(str[i]) ; if( k == 0 ) { num++ ; flag = 0 ; } else if( k == 1 ) { a++ ; solve(i-1,num,c_num) ; flag = num = c_num = 0 ; } else if( k == 2 ) { a++ ; b++ ; solve(i-1,num,c_num) ; flag = num = c_num = 0 ; } else if( k == 3 ) { num++ ; if( flag == 0 ) { c_num++ ; flag = 1 ; } } } k = find1(str[l-1]) ; if( k == 0 || k == 3 ) { a++ ; solve(l-1,num,c_num) ; } } printf("%.2lf\n", 206.835 - 1.015*(a*1.0)/(b*1.0) - 84.6*(c*1.0)/(a*1.0) ); return 0;}
- poj3371--Flesch Reading Ease(模拟)
- Flesch Reading Ease -POJ3371模拟
- poj3371 Flesch Reading Ease
- Flesch Reading Ease--模拟
- Flesch Reading Ease 模拟
- POJ 3371:Flesch Reading Ease 模拟
- 【POJ 3371】 Flesch Reading Ease(模拟)
- Flesch Reading Ease poj 3371 模拟
- Flesch Reading Ease(模拟题)
- 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
- [objc.io]基础集合类思维导图
- 优先队列自动排序
- IOS中字符串与数组的处理
- 切线空间计算
- 最新Xcode4.5.1新特性——container view控件的用法
- poj3371--Flesch Reading Ease(模拟)
- elasticsearch安装配置及中文分词
- IOS 30多个iOS常用动画,带详细注释
- Netty 长连接服务
- ios开发中归档的使用
- elasticsearch中文分词
- Java方法
- 工作中英语积累10
- linux产生随机数