Poj3371 -- Flesch Reading transform (simulation)

Source: Internet
Author: User

Poj3371 -- Flesch Reading transform (simulation)
Flesch Reading history

Time Limit:1000 MS Memory Limit:65536 K
Total Submissions:1882 Accepted:553

Description

Flesch Reading failed, a readability test named after its deviser Rudolf Flesch, is among most ready used readability tests, which are principally employed for assessment of the difficulty to understand a reading passage written in English. the Flesch Reading 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 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 Readin G keys [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 operation. for the sake of precision and uniformity, the following restrictions adapted from [2] are adopted for this problem, to which you are writing a solution that requires tively computes the Flesch Reading 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 (random t-le) endings are ignored, words of three letters or shorter count as single syllables, consecutive vowels count as one syllable. referencesWikipedia contributors. flesch-Kincaid Readability Test. wikipedia, The Free Encyclopedia. august 30,200 7, UTC. available at: http://en.wikipedia.org/w /Index. php? Title = Flesch -Kincaid_Readability_Test & Amp; 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 score is to be computed. only letters of the English alphabet (both lowercase and uppercase), common punctuation marks (periods, question and exclamation marks, colons, 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 regression 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

    Give a standard English section, calculate the number of words, sentences, and syllables, and calculate the result through the formula.

    Standard symbol ',''''.'';'':''! ''? 'All English symbols are commas (,) and spaces. Only words are separated. Periods, semicolons, colons, exclamation marks, question marks, and sentences and words.

    When calculating Bytes:

    1. If the word length is less than or equal to 3, the syllable is 1.

    2. If the value is greater than 3, the uppercase letters a, e, I, o, u, and y are case sensitive, and each letter is a syllable. If the end is-e (-le is not counted ), -es,-ed end e is not recorded as a syllable.

    # Include
      
       
    # Include
       
        
    # Include using namespace std; char str [1000]; int a, B, c; // number of a words, number of B sentences, and number of c syllables 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; // whether the first character of the current flag is the original audio, the number of letters of the current word of num, c_num original number of words 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 ;}
       
      

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.