lib/datasets/communities.rb in red-datasets-0.1.4 vs lib/datasets/communities.rb in red-datasets-0.1.5
- old
+ new
@@ -138,10 +138,11 @@
def initialize
super()
@metadata.id = "communities"
@metadata.name = "Communities"
@metadata.url = "https://archive.ics.uci.edu/ml/datasets/communities+and+crime"
+ @metadata.licenses = ["CC-BY-4.0"]
@metadata.description = lambda do
read_names
end
end
@@ -175,24 +176,20 @@
"https://archive.ics.uci.edu/ml/machine-learning-databases/communities"
end
def open_data
data_path = cache_dir_path + "communities.data"
- unless data_path.exist?
- data_url = "#{base_url}/communities.data"
- download(data_path, data_url)
- end
+ data_url = "#{base_url}/communities.data"
+ download(data_path, data_url)
CSV.open(data_path) do |csv|
yield(csv)
end
end
def read_names
names_path = cache_dir_path + "communities.names"
- unless names_path.exist?
- names_url = "#{base_url}/communities.names"
- download(names_path, names_url)
- end
+ names_url = "#{base_url}/communities.names"
+ download(names_path, names_url)
names_path.read
end
end
end