Class: TextRazor::Word

Inherits:
Object
  • Object
show all
Extended by:
Util
Defined in:
lib/textrazor/word.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

standardize

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_posObject (readonly)

Returns the value of attribute ending_pos.



7
8
9
# File 'lib/textrazor/word.rb', line 7

def ending_pos
  @ending_pos
end

#lemmaObject (readonly)

Returns the value of attribute lemma.



7
8
9
# File 'lib/textrazor/word.rb', line 7

def lemma
  @lemma
end

#parent_positionObject (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_speechObject (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

#positionObject (readonly)

Returns the value of attribute position.



7
8
9
# File 'lib/textrazor/word.rb', line 7

def position
  @position
end

#starting_posObject (readonly)

Returns the value of attribute starting_pos.



7
8
9
# File 'lib/textrazor/word.rb', line 7

def starting_pos
  @starting_pos
end

#stemObject (readonly)

Returns the value of attribute stem.



7
8
9
# File 'lib/textrazor/word.rb', line 7

def stem
  @stem
end

#tokenObject (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