Flesch Reading Ease

Time Limit: 1000MS Memory Limit: 65536K

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.

  1. Periods, explanation points, colons and semicolons serve as sentence delimiters.
  2. Each group of continuous non-blank characters with beginning and ending punctuation removed counts as a word.
  3. 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

  1. 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.
  2. 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 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

Source

POJ Monthly–2007.09.09, frkstyc

题意:标记单词分隔符: 逗号(,) 和 空格( )句子分隔符:句号(.) 问号(?) 冒号(:) 分号(;) 感叹号(!).不存在上述标点符号以外的符号!!!所有符号只占一个字符的位置!!

每出现一个单词分隔符,单词数+1

每出现一个句子分隔符,句子数+1

音节数是最难处理的,其规律如下:

(1)当单词总长度<=3时,音节数无条件+1

(2)当单词总长度>3时,单词中每出现一个元音字母(a、e、i、o、u、y),音节数+1,但是连续的元音字母只按1个音节计算,且当单词后缀为-es、-ed和-e时,后缀的元音字母e不列为音节数计算。但是后缀-le例外,要计算音节数。

注意:

(1)元音字母要判断12个,6个小写,6个大写。

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define RR() freopen("in.txt","r",stdin) using namespace std; char str[110]; bool Judgeapl(char s)//判断是否时字母
{
if(s>='a'&&s<='z'||s>='A'&&s<='Z')
{
return true;
}
return false;
} bool Trans(char s)//判断是否是元音
{
if(s>='A'&&s<='Z')
{
s=s-'A'+'a';
}
if(s=='a'||s=='e'||s=='i'||s=='o'||s=='u'||s=='y')
{
return true;
}
return false;
} char low(char s)//大写转小写
{
if(s>='A'&&s<='Z')
{
return s-'A'+'a';
}
return s;
} int Judgesyl(char *s,int len)//判断元音节
{
if(len<=3)
{
return 1;
} int num = 0; int ans = 0; for(int i=0; i<len; i++)
{
if(Trans(str[i]))
{
ans=0; while(Trans(str[i])&&i<len)
{
i++;
ans++;
}
i--;
num++;
}
}
if(low(s[len-1])=='e'&&low(s[len-2])!='l'&&!Trans(s[len-2]))
{
num--;
}
else if(low(s[len-2]) == 'e' &&(low(s[len-1]=='s'||low(s[len-1])=='d'))&&!Trans(s[len-3]))
{
num--;
}
return num;
} int main()
{
int wnum=0,snum=0,senum=0;
while(~scanf("%s",str))
{ int len=strlen(str);
wnum++;
if(!Judgeapl(str[len-1]))
{
if(str[len-1]!=',')
senum++;
len--;
} snum+=Judgesyl(str,len); }
printf("%.2f\n",206.835-1.015*(wnum*1.0/senum)-84.6*(snum*1.0/wnum));
return 0;
}

Flesch Reading Ease -POJ3371模拟的更多相关文章

  1. POJ 3371:Flesch Reading Ease 模拟

    Flesch Reading Ease Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2071   Accepted: 60 ...

  2. Flesch Reading Ease(模拟)

    http://poj.org/problem?id=3371 终于遇到简单一点的模拟题了.不过本人真心没有耐心读题目... 它的大致意思就是给一段合法的文章,求出这段文章的单词数,句子数,音节数,按照 ...

  3. POJ 3371 Flesch Reading Ease 无聊恶心模拟题

    题目:http://poj.org/problem?id=3371 无聊恶心题,还是不做的好,不但浪费时间而且学习英语. 不过为了做出点技术含量,写了个递归函数... 还有最后判断es,ed,le时只 ...

  4. Flesch Reading Ease (poj 3371)

    题意: 给出一篇规范的文章,求其 句子数.单词数 和 音节数把这3个值代入题目给出的公式,输出其结果,保留2位小数. 标记单词分隔符: 逗号(,) 和 空格( ) 句子分隔符:句号(.) 问号(?) ...

  5. poj 3371 Flesch Reading Ease

    http://poj.org/problem?id=3371 #include<cstdio> #include<cstring> #include<algorithm& ...

  6. poj3371

    Flesch Reading Ease Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2269 Accepted: 710 De ...

  7. Readability Assessment for Text Simplification -paper

    https://pdfs.semanticscholar.org/e43a/3c3c032cf3c70875c4193f8f8818531857b2.pdf 1.introduction在Brazil ...

  8. 884A. Book Reading#抽空学习好孩子(模拟)

    题目出处:http://codeforces.com/problemset/problem/884/A 题目大意:每天时间分两部分,工作和学习,工作优先,闲暇读书,问第几天读完 #include< ...

  9. Codeforces Round #653 (Div. 3) E1. Reading Books (easy version) (贪心,模拟)

    题意:有\(n\)本书,A和B都至少要从喜欢的书里面读\(k\)本书,如果一本书两人都喜欢的话,那么他们就可以一起读来节省时间,问最少多长时间两人都能够读完\(k\)本书. 题解:我们可以分\(3\) ...

随机推荐

  1. PHP和HTML代码混合编译的三种方法

    第一种是在HTML中加PHP. 大段大段的html代码中,在各个需要执行php的地方<?php .... ?> 比如 line7-9: 1 <head> 2 <meta ...

  2. iOS10 适配、Xcode8配置总结

    随着iOS10的推送更新到来,勤劳的程序员又在加班加点的搬砖了,为此收集了一些iOS10 更新的技能给大伙参考,不断更新喜欢就star 前沿 一.Xcode8 插件你去哪了 以为是和之前一样 Xcod ...

  3. centos7 添加svn

    预期目的: 1.仓库放在 /var/svn/ 目录下,并且仓库名为 project 2.创建用户组lsgogroup,该组下添加两个成员lsgoweb1.lsgoweb2,密码直接用用户名,两用户可以 ...

  4. 有关windows系统的EXE和DLL文件说法错误

    正确答案: B C   你的答案: C (错误) EXE和DLL文件都是PE文件 EXE不能有导出函数,DLL可以有导出函数 EXE有x86和x64之分,则DLL没有 EXE可以单独运行,DLL则不行 ...

  5. 关于swap函数传值的问题

    #include <stdio.h> void swap(int * p3,int * p4); int main() {  int a = 9;  int b = 8;  int * p ...

  6. Android界面组件的四种启动方式

    Android界面组件启动有四种方式 standard,singleTop,singleTask,singleInstance. standard:每次调用都会都会产生新的组件. singletop: ...

  7. java 关键字查询时的转义操作

    /** * mysql模糊查询时,如果查询关键字本身包含_和%,需要转义 * * @param queryKey 查询关键字 * @return 转义字符 */ private String conv ...

  8. 枚举Enum

    #region 根据枚举名称获取值或反之        /// <summary>        /// 根据枚举的名称,得到该枚中该名称对应的值        /// </summ ...

  9. 动态SQL语句之sp_executesql的使用

    sp_executesql,sql2005中引入的新的系统存储过程,也是用来处理动态sql的, 如: exec sp_executesql @sql, N'@item_name nvarchar(10 ...

  10. Spark on Yarn:java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://localhost\\db_instance_name:1433;databaseName=db_name

    本文只是针对当前特定环境下,出现的问题找不到sqljdbc驱动的案例.具体出现原因,可能是spark版本问题,也可能是集群配置问题. yarn-client方式下: 通过--jars参数指定驱动文件位 ...