Method: Juman::Morpheme#initialize
- Defined in:
- lib/juman/morpheme.rb
#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 |