lib/lsa.rb in lsa-0.1.0 vs lib/lsa.rb in lsa-0.1.1

- old
+ new

@@ -2,28 +2,26 @@ require "abort_if" include AbortIf - - - module Lsa - def clean_str str str.strip.gsub(/[^\p{Alnum}_]+/, "_").gsub(/_+/, "_") end - def parse_mapping_file mapping_fname, mmseqs_final_outf data_labels = [] label2outf = {} doc2new_doc = {} File.open(mapping_fname, "rt").each_line.with_index do |line, idx| if idx.zero? - curren_label, *data_labels = line.chomp.split("\t").map do |str| + current_label, *data_labels = line.chomp.split("\t").map do |str| clean_str str end + + abort_if data_labels.any? { |label| label == "original" }, + "Illegal data label: 'original'. Please change it." abort_unless data_labels.uniq.count == data_labels.count, "The data labels are not unique in #{mapping_fname}" data_labels.each do |label|