X-Git-Url: http://jaekl.net/gitweb/?p=quanlib.git;a=blobdiff_plain;f=classify%2Fclassset.rb;h=4613fc746ee8ec5fe5c9d7052e806592ca916a7e;hp=710db7a3c89633c1cc7afbd28839de91b3ecdd59;hb=0aeb88ddc91aa8f9fd8d93a8004d5df5094a4613;hpb=b8fe580f73b094e366643388ecd2d184b643616a diff --git a/classify/classset.rb b/classify/classset.rb index 710db7a..4613fc7 100644 --- a/classify/classset.rb +++ b/classify/classset.rb @@ -67,16 +67,18 @@ class ClassSet lcc = row[1] grouping = row[2] author = row[3] - title = row[4] + filename = row[4] + title = row[5] fast = [] - if nil != row[5] - fast = row[5].split(';') + if nil != row[6] + fast = row[6].split(';') end bookclass = BookClass.new(grouping, title) bookclass.ddc = ddc bookclass.lcc = lcc bookclass.author = author + bookclass.filename = filename fast.each do |id| bookclass.add_fast(id) @@ -84,6 +86,8 @@ class ClassSet key = construct_key(grouping, title) @entries[key] = bookclass + + #puts 'LOADED[' + key.inspect + ']: ' + bookclass.inspect end end end @@ -91,24 +95,22 @@ class ClassSet def save(file_name) CSV.open(file_name, 'w:UTF-8') do |csv| - csv << ['Dewey', 'LCC', 'Grouping', 'Author', 'Title', 'FAST'] + csv << ['Dewey', 'LCC', 'Grouping', 'Author', 'Filename', 'Title', 'FAST'] @entries.keys.sort.each do |key| info = @entries[key] + #puts 'SAVING[' + key.inspect + ']: ' + info.inspect + ddc = info.ddc lcc = info.lcc grouping = info.grouping author = info.author + filename = info.filename title = info.title - fast_list = info.fast - fast_ids = [] - fast_list.each do |tuple| - fast_ids.push(tuple[0]) - end - fast = fast_ids.join(';') + fast = info.fast.join(';') - csv << [ ddc, lcc, grouping, author, title, fast ] + csv << [ ddc, lcc, grouping, author, filename, title, fast ] end end end