Class: Juman::Morpheme
- Inherits:
-
Object
- Object
- Juman::Morpheme
- Defined in:
- lib/juman/morpheme.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#form_id ⇒ Object
readonly
Returns the value of attribute form_id.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
-
#pos_id ⇒ Object
readonly
Returns the value of attribute pos_id.
-
#pos_spec ⇒ Object
readonly
Returns the value of attribute pos_spec.
-
#pos_spec_id ⇒ Object
readonly
Returns the value of attribute pos_spec_id.
-
#pronunciation ⇒ Object
readonly
Returns the value of attribute pronunciation.
-
#surface ⇒ Object
readonly
Returns the value of attribute surface.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type_id ⇒ Object
readonly
Returns the value of attribute type_id.
Instance Method Summary collapse
-
#initialize(line) ⇒ Morpheme
constructor
A new instance of Morpheme.
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
#base ⇒ Object (readonly)
Returns the value of attribute base.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def base @base end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def form @form end |
#form_id ⇒ Object (readonly)
Returns the value of attribute form_id.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def form_id @form_id end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def info @info end |
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def pos @pos end |
#pos_id ⇒ Object (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_spec ⇒ Object (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_id ⇒ Object (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 |
#pronunciation ⇒ Object (readonly)
Returns the value of attribute pronunciation.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def pronunciation @pronunciation end |
#surface ⇒ Object (readonly)
Returns the value of attribute surface.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def surface @surface end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def type @type end |
#type_id ⇒ Object (readonly)
Returns the value of attribute type_id.
12 13 14 |
# File 'lib/juman/morpheme.rb', line 12 def type_id @type_id end |