Class: YmaParser
- Inherits:
-
Object
- Object
- YmaParser
- Defined in:
- lib/yma_parser.rb
Instance Attribute Summary collapse
-
#filtered_count ⇒ Object
readonly
Returns the value of attribute filtered_count.
-
#total_count ⇒ Object
readonly
Returns the value of attribute total_count.
-
#word_list ⇒ Object
readonly
Returns the value of attribute word_list.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(xml) ⇒ YmaParser
constructor
A new instance of YmaParser.
Constructor Details
#initialize(xml) ⇒ YmaParser
Returns a new instance of YmaParser.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/yma_parser.rb', line 4 def initialize(xml) @xml = REXML::Document.new(xml) @total_count = @xml.elements['//total_count'].text.to_i @filtered_count = @xml.elements['//filtered_count'].text.to_i @word_list = @xml.elements['//word_list'].map do |word| { :surface=>word.elements['surface'].text, :reading=>word.elements['reading'].text, :pos=>word.elements['pos'].text } end end |
Instance Attribute Details
#filtered_count ⇒ Object (readonly)
Returns the value of attribute filtered_count.
3 4 5 |
# File 'lib/yma_parser.rb', line 3 def filtered_count @filtered_count end |
#total_count ⇒ Object (readonly)
Returns the value of attribute total_count.
3 4 5 |
# File 'lib/yma_parser.rb', line 3 def total_count @total_count end |
#word_list ⇒ Object (readonly)
Returns the value of attribute word_list.
3 4 5 |
# File 'lib/yma_parser.rb', line 3 def word_list @word_list end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
3 4 5 |
# File 'lib/yma_parser.rb', line 3 def xml @xml end |