Class: NLP::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeText

Returns a new instance of Text.



5
6
7
# File 'lib/text.rb', line 5

def initialize
    @sentences = []
end

Instance Attribute Details

#sentencesObject (readonly)

Returns the value of attribute sentences.



3
4
5
# File 'lib/text.rb', line 3

def sentences
  @sentences
end

Instance Method Details

#<<(sentence) ⇒ Object



9
10
11
# File 'lib/text.rb', line 9

def << sentence
    @sentences.push sentence
end

#words_per_sentenceObject



14
15
16
# File 'lib/text.rb', line 14

def words_per_sentence
    mean(@sentences.collect{|s| s.words_number})
end