Class: Datasets::LIBSVMDatasetList

Inherits:
Dataset
  • Object
show all
Defined in:
lib/datasets/libsvm-dataset-list.rb

Defined Under Namespace

Classes: DescriptionListener, DetailListener, File, IndexListener, Record

Instance Attribute Summary

Attributes inherited from Dataset

#metadata

Instance Method Summary collapse

Methods inherited from Dataset

#clear_cache!, #to_table

Constructor Details

#initializeLIBSVMDatasetList

Returns a new instance of LIBSVMDatasetList.



26
27
28
29
30
31
32
33
34
35
# File 'lib/datasets/libsvm-dataset-list.rb', line 26

def initialize
  super()
  @metadata.id = "libsvm-dataset-list"
  @metadata.name = "LIBSVM dataset list"
  @metadata.url = "https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/"
  @metadata.licenses = ["BSD-3-Clause"]
  @metadata.description = lambda do
    extract_description
  end
end

Instance Method Details

#each(&block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/datasets/libsvm-dataset-list.rb', line 37

def each(&block)
  return to_enum(__method__) unless block_given?

  open_data do |input|
    catch do |abort_tag|
      listener = IndexListener.new(abort_tag) do |href, record|
        parse_detail(href, record)
        yield(record)
      end
      parser = REXML::Parsers::StreamParser.new(input, listener)
      parser.parse
    end
  end
end