Method: Lingua::EN::Readability#initialize
- Defined in:
- lib/lingua/en/readability.rb
#initialize(text) ⇒ Readability
The constructor accepts the text to be analysed, and returns a report object which gives access to the
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lingua/en/readability.rb', line 14 def initialize(text) @text = text.dup @paragraphs = text.split(/\n\s*\n\s*/) @sentences = Lingua::EN::Sentence.sentences(@text) @words = [] @frequencies = {} @frequencies.default = 0 @syllables = 0 @complex_words = 0 count_words end |