Class: Juman::Morpheme

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ Morpheme

Returns a new instance of Morpheme.



3
4
5
6
7
8
9
10
11
# File 'lib/juman/morpheme.rb', line 3

def initialize(line)
  attributes = line.split(/\s/)
  @surface, @pronunciation, @base, @pos = attributes.shift(4)
  @pos_id, @pos_spec_id, @type_id, @form_id =
    attributes.values_at(0, 2, 4, 6).map{|id_str| id_str.to_i }
  @pos_spec, @type, @form =
    attributes.values_at(1, 3, 5).map{|attr| normalize_attr(attr) }
  @info = normalize_info(attributes[7..-1].join(' '))
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def base
  @base
end

#formObject (readonly)

Returns the value of attribute form.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def form
  @form
end

#form_idObject (readonly)

Returns the value of attribute form_id.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def form_id
  @form_id
end

#infoObject (readonly)

Returns the value of attribute info.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def info
  @info
end

#posObject (readonly)

Returns the value of attribute pos.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def pos
  @pos
end

#pos_idObject (readonly)

Returns the value of attribute pos_id.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def pos_id
  @pos_id
end

#pos_specObject (readonly)

Returns the value of attribute pos_spec.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def pos_spec
  @pos_spec
end

#pos_spec_idObject (readonly)

Returns the value of attribute pos_spec_id.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def pos_spec_id
  @pos_spec_id
end

#pronunciationObject (readonly)

Returns the value of attribute pronunciation.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def pronunciation
  @pronunciation
end

#surfaceObject (readonly)

Returns the value of attribute surface.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def surface
  @surface
end

#typeObject (readonly)

Returns the value of attribute type.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def type
  @type
end

#type_idObject (readonly)

Returns the value of attribute type_id.



12
13
14
# File 'lib/juman/morpheme.rb', line 12

def type_id
  @type_id
end