Mercurial > hg > mirex-meta-analysis
view xml2txt.rb @ 4:92b5a46bc67b
Made a bunch of progressive updates to several files. Focused on adding comments that will print to screen to keep the user availed of progress.
author | Jordan Smith <jordan.smith@eecs.qmul.ac.uk> |
---|---|
date | Sat, 07 Dec 2013 18:18:50 +0000 |
parents | 624231da830b |
children |
line wrap: on
line source
require 'xmlsimple' # Script to convert Ewald Peiszer's XML annotations to my TXT format annotations. a = XmlSimple.xml_in(ARGV[0]) rows = [] a["segmentation"][0]["segment"].each do |item| rows << [item["start_sec"],item["label"]].join("\t") end rows << [a["segmentation"][0]["segment"][-1]["end_sec"],"end"].join("\t") if ARGV[1].nil? then filename = ARGV[0].split(".")[0..-2].join(".") else filename = ARGV[1].chomp end c = File.open(filename+".txt",'w') c.write(rows) c.close