Sha256: 353c163b40fd6ef6eabe407bbfbbab8f4acd60312fabf7f15dcc3fcb0c3c3ed7

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 Bytes

Contents

#!/usr/bin/env ruby

require_relative '../lib/MESH'
tr = MESH::Translator.new(MESH::Translator.enus_to_engb)

filename = File.expand_path('../../data/mesh_data_2014/d2014.bin.gz', __FILE__)
gzipped_file = File.open(filename)
file = Zlib::GzipReader.new(gzipped_file)

file.each_line do |line|
  case
    when line.start_with?('*NEWRECORD')
      puts "\n*NEWRECORD"
    when line.start_with?('UI = ')
      puts line
    when line.start_with?('MH = ')
      puts tr.translate(line)
    when line.start_with?('MS = ')
      puts tr.translate(line)
    when line.start_with?('PRINT ENTRY = ')
      puts tr.translate(line)
    when line.start_with?('ENTRY = ')
      puts tr.translate(line)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mesh-medical-subject-headings-3.0.0 bin/translate