Class: NLP::Sentence
- Inherits:
-
Object
- Object
- NLP::Sentence
- Defined in:
- lib/tagger/sentence.rb
Instance Attribute Summary collapse
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
- #<<(tokens) ⇒ Object
-
#initialize ⇒ Sentence
constructor
A new instance of Sentence.
- #words_number ⇒ Object
Constructor Details
#initialize ⇒ Sentence
Returns a new instance of Sentence.
6 7 8 |
# File 'lib/tagger/sentence.rb', line 6 def initialize() @tokens = [] end |
Instance Attribute Details
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
4 5 6 |
# File 'lib/tagger/sentence.rb', line 4 def tokens @tokens end |
Instance Method Details
#<<(tokens) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/tagger/sentence.rb', line 10 def << tokens if tokens.is_a? Array @tokens.concat tokens else @tokens << tokens end self end |
#words_number ⇒ Object
19 20 21 |
# File 'lib/tagger/sentence.rb', line 19 def words_number @tokens.count{|t| !t.interp?} end |