diff --git a/lib/tasks/tag_frequency_hash.rake b/lib/tasks/tag_frequency_hash.rake deleted file mode 100644 index 791feabeb36a11bd68dd1cbc93a232fc6ddc1e18..0000000000000000000000000000000000000000 --- a/lib/tasks/tag_frequency_hash.rake +++ /dev/null @@ -1,42 +0,0 @@ -require 'json' -namespace :tag do - desc 'Generate tag frequency hash' - task generate_tag_frequency_hash: :environment do - hash = {} - name = {} - - LearningObject.all.each do |lo| - # for each lo, count tags and tag pairs and add to hash - # if id1 <= id2 - # hash[id1][id2] will equal how many times tags with id1 and id2 appear together on a LO - # hash[id][id] will equal how many times tag of id appears - lo.tags.each.with_index do |t, i| - name[t.id] = t.name - hash[t.id] = {} if hash[t.id].nil? - if hash[t.id][t.id] != nil - hash[t.id][t.id] += 1 - else - hash[t.id][t.id] = 1 - end - lo.tags.drop(i+1).each do |t2| - hash[t2.id] = {} if hash[t2.id].nil? - - if hash[t.id][t2.id] != nil - hash[t.id][t2.id] += 1 - hash[t2.id][t.id] += 1 - else - hash[t.id][t2.id] = 1 - hash[t2.id][t.id] = 1 - end - end - end - end - - File.open("tag_frequency_hash.json", "w+") do |f| - f << hash.to_json - end - File.open("tag_name.json", "w+") do |f| - f << name.to_json - end - end -end