class

Cadmium::Readability

Inherits Reference / Object

A syntactical analyzer that helps determine the readibility of a block of text.

Constructors

new(text)

The constructor accepts the text to be analysed, and returns a report object which gives access to the

Source

Instance methods

flesch

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.

Source
fog

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.

Source
frequencies
Source
kincaid

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.

Source
num_chars

The number of characters in the sample.

Source
num_paragraphs

The number of paragraphs in the sample. A paragraph is defined as a newline followed by one or more empty or whitespace-only lines.

Source
num_sentences

The number of sentences in the sample. The meaning of a "sentence" is defined by Cadmium::Util::Sentence.

Source
num_syllables

The total number of syllables in the text sample. Just for completeness.

Source
num_unique_words

The number of different unique words used in the text sample.

Source
num_words

The total number of words used in the sample. Numbers as digits are not counted.

Source
occurrences(word)

The number of occurences of the word +word+ in the text sample.

Source
paragraphs
Source
percent_fog_complex_words

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.

Source
report

Return a nicely formatted report on the sample, showing most the useful statistics about the text sample.

Source
sentences
Source
syllables_per_word

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.

Source
text
Source
unique_words

An array containing each unique word used in the text sample.

Source
words
Source
words_per_sentence

The average number of words per sentence.

Source