class Cadmium::Readability

Overview

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

Defined in:

cadmium/readability.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(text) #

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


[View source]

Instance Method Detail

def 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.


[View source]
def 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.


[View source]
def frequencies : Hash(String, Int32) #

[View source]
def 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.


[View source]
def num_chars #

The number of characters in the sample.


[View source]
def 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.


[View source]
def num_sentences #

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


[View source]
def num_syllables : Int32 #

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


[View source]
def num_unique_words #

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


[View source]
def num_words #

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


[View source]
def occurrences(word) #

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


[View source]
def paragraphs : Array(String) #

[View source]
def 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.


[View source]
def report #

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


[View source]
def sentences : Array(String) #

[View source]
def 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.


[View source]
def text : String #

[View source]
def unique_words #

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


[View source]
def words : Array(String) #

[View source]
def words_per_sentence #

The average number of words per sentence.


[View source]