lib/datasets/libsvm.rb in red-datasets-0.1.4 vs lib/datasets/libsvm.rb in red-datasets-0.1.5
- old
+ new
@@ -39,10 +39,11 @@
@file = choose_file(note)
@default_feature_value = default_feature_value
@metadata.id = "libsvm-#{normalize_name(name)}"
@metadata.name = "LIBSVM dataset: #{name}"
@metadata.url = "https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/"
+ @metadata.licenses = ["BSD-3-Clause"]
end
def each
return to_enum(__method__) unless block_given?
@@ -97,16 +98,14 @@
raise ArgumentError, message
end
def open_data(&block)
data_path = cache_dir_path + @file.name
- unless data_path.exist?
- download(data_path, @file.url)
- end
+ download(data_path, @file.url)
if data_path.extname == ".bz2"
extract_bz2(data_path, &block)
else
- File.open(data_path, &block)
+ data_path.open(&block)
end
end
def normalize_name(name)
name.gsub(/[()]/, "").gsub(/[ _;]+/, "-").downcase