Class: TextRazor::Word
- Inherits:
-
Object
- Object
- TextRazor::Word
- Extended by:
- Util
- Defined in:
- lib/textrazor/word.rb
Instance Attribute Summary collapse
-
#ending_pos ⇒ Object
readonly
Returns the value of attribute ending_pos.
-
#lemma ⇒ Object
readonly
Returns the value of attribute lemma.
-
#parent_position ⇒ Object
readonly
Returns the value of attribute parent_position.
-
#part_of_speech ⇒ Object
readonly
Returns the value of attribute part_of_speech.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#starting_pos ⇒ Object
readonly
Returns the value of attribute starting_pos.
-
#stem ⇒ Object
readonly
Returns the value of attribute stem.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Word
constructor
A new instance of Word.
Methods included from Util
Constructor Details
#initialize(params = {}) ⇒ Word
Returns a new instance of Word.
10 11 12 13 14 15 |
# File 'lib/textrazor/word.rb', line 10 def initialize(params = {}) @type = [] params.each do |k, v| instance_variable_set(:"@#{k}", v) if v && self.respond_to?(:"#{k}") end end |
Instance Attribute Details
#ending_pos ⇒ Object (readonly)
Returns the value of attribute ending_pos.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def ending_pos @ending_pos end |
#lemma ⇒ Object (readonly)
Returns the value of attribute lemma.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def lemma @lemma end |
#parent_position ⇒ Object (readonly)
Returns the value of attribute parent_position.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def parent_position @parent_position end |
#part_of_speech ⇒ Object (readonly)
Returns the value of attribute part_of_speech.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def part_of_speech @part_of_speech end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def position @position end |
#starting_pos ⇒ Object (readonly)
Returns the value of attribute starting_pos.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def starting_pos @starting_pos end |
#stem ⇒ Object (readonly)
Returns the value of attribute stem.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def stem @stem end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/textrazor/word.rb', line 7 def token @token end |
Class Method Details
.create_from_hash(params) ⇒ Object
17 18 19 20 |
# File 'lib/textrazor/word.rb', line 17 def self.create_from_hash(params) params = Hash[params.map {|k, v| [standardize(k), v] }] new(params) end |