Skip to content

Instantly share code, notes, and snippets.

@mrkn
Created March 9, 2011 02:12
Show Gist options
  • Save mrkn/861563 to your computer and use it in GitHub Desktop.
Save mrkn/861563 to your computer and use it in GitHub Desktop.
require 'zlib'
filename = 'CONTENT'
#filename = 'NAME'
#filename = 'TITLE'
data = []
open(filename + '.tda.tdz', 'rb') do |idx|
open(filename + '.tda', 'rb') do |dat|
until idx.eof?
pre_size, post_size = idx.read(8).unpack('V*')
p [pre_size, post_size]
deflated = dat.read(post_size)
inflated = Zlib::Inflate.inflate(deflated)
p inflated.bytesize
data << inflated
end
end
end
data.each do |d|
d.split(/\0+/).each do |x|
puts x
end
end
@sdomermpc
Copy link

is this coded in ruby, perl or python?

@sdomermpc
Copy link

buddy help me extract XML from this Longman Advanced American Dictionary
http://rghost.net/52258765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment