Sha256: ce0ad56c60c2e8adfe295c42a85cf5b5c865159cf085a778b13deaf7e327bb53

Contents?: true

Size: 746 Bytes

Versions: 10

Compression:

Stored size: 746 Bytes

Contents

#!/usr/bin/ruby
# -*- coding: utf-8 -*-

require 'rexml/document'
require 'rexml/parsers/streamparser'
require 'rexml/parsers/baseparser'
require 'rexml/streamlistener'

#REXML::Document.new(STDIN)

class MyListener
  include REXML::StreamListener
  def tag_start(name, attrs)
    # p name, attrs
    case name
    when 'entry'
      @n = 0
    end
  end
  def tag_end name
    # p "tag_end: #{x}"
    case name
    when 'sense'
      @n += 1
    when 'entry'
      @n_ents += 1
      puts "#{@ent}:#{@n}" if (@n > 8)
    when 'ent_seq'
      @ent = @text
    end
  end

  def text(text)
    @text = text
  end

  def xmldecl(version, encoding, standalone)
    @n_ents = 0
  end
end

REXML::Parsers::StreamParser.new(STDIN, MyListener.new).parse

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rroonga-2.0.2-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-2.0.1-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-2.0.0-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-1.3.1-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-1.3.0-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-1.2.7-x86-mswin32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-1.2.7-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-1.2.5-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-1.1.0-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb
rroonga-1.0.1-x86-mingw32 vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb