jordan@2: require 'xmlsimple' jordan@2: jordan@2: # Script to convert Ewald Peiszer's XML annotations to my TXT format annotations. jordan@2: jordan@2: a = XmlSimple.xml_in(ARGV[0]) jordan@2: rows = [] jordan@2: a["segmentation"][0]["segment"].each do |item| jordan@2: rows << [item["start_sec"],item["label"]].join("\t") jordan@2: end jordan@2: rows << [a["segmentation"][0]["segment"][-1]["end_sec"],"end"].join("\t") jordan@2: jordan@2: if ARGV[1].nil? then jordan@2: filename = ARGV[0].split(".")[0..-2].join(".") jordan@2: else jordan@2: filename = ARGV[1].chomp jordan@2: end jordan@2: jordan@2: c = File.open(filename+".txt",'w') jordan@2: c.write(rows) jordan@2: c.close