class Cadmium::Readability
- Cadmium::Readability
- Reference
- Object
Overview
A syntactical analyzer that helps determine the readibility of a block of text.
Defined in:
cadmium/readability.crConstructors
-
.new(text)
The constructor accepts the text to be analysed, and returns a report object which gives access to the
Instance Method Summary
-
#flesch
Flesch reading ease of the text sample.
-
#fog
The Gunning Fog Index of the text sample.
- #frequencies : Hash(String, Int32)
-
#kincaid
Flesch-Kincaid level of the text sample.
-
#num_chars
The number of characters in the sample.
-
#num_paragraphs
The number of paragraphs in the sample.
-
#num_sentences
The number of sentences in the sample.
-
#num_syllables : Int32
The total number of syllables in the text sample.
-
#num_unique_words
The number of different unique words used in the text sample.
-
#num_words
The total number of words used in the sample.
-
#occurrences(word)
The number of occurences of the word +word+ in the text sample.
- #paragraphs : Array(String)
-
#percent_fog_complex_words
The percentage of words that are defined as "complex" for the purpose of the Fog Index.
-
#report
Return a nicely formatted report on the sample, showing most the useful statistics about the text sample.
- #sentences : Array(String)
-
#syllables_per_word
The average number of syllables per word.
- #text : String
-
#unique_words
An array containing each unique word used in the text sample.
- #words : Array(String)
-
#words_per_sentence
The average number of words per sentence.
Constructor Detail
The constructor accepts the text to be analysed, and returns a report object which gives access to the
Instance Method Detail
Flesch reading ease of the text sample. A higher score indicates text that is easier to read. The score is on a 100-point scale, and a score of 60-70 is regarded as optimal for ordinary text.
The Gunning Fog Index of the text sample. The index indicates the number of years of formal education that a reader of average intelligence would need to comprehend the text. A higher score indicates harder text; a value of around 12 is indicated as ideal for ordinary text.
Flesch-Kincaid level of the text sample. This measure scores text based on the American school grade system; a score of 7.0 would indicate that the text is readable by a seventh grader. A score of 7.0 to 8.0 is regarded as optimal for ordinary text.
The number of paragraphs in the sample. A paragraph is defined as a newline followed by one or more empty or whitespace-only lines.
The number of sentences in the sample. The meaning of a "sentence" is defined by Cadmium::Util::Sentence.
The total number of syllables in the text sample. Just for completeness.
The percentage of words that are defined as "complex" for the purpose of the Fog Index. This is non-hyphenated words of three or more syllabes.
Return a nicely formatted report on the sample, showing most the useful statistics about the text sample.
The average number of syllables per word. The syllable count is performed by Cadmium::Util::Syllable, and so may not be completely accurate, especially if the Carnegie-Mellon Pronouncing Dictionary is not installed.