<commit_before>class ConvertNamesInTaggingsToTags < ActiveRecord::Migration
  def self.up
    Tagging.all.each do |tagging|
      # Must use array index to avoid the "belongs_to :tag"-relation
      next if tagging["tag"].blank?
      tagging.tag = Tag.find_or_create_with_like_by_name(tagging["tag"])
      tagging.save!
    end
  end

  def self.down
  end
end
<commit_msg>Improved the tagging -> tag conversion script<commit_after>class ConvertNamesInTaggingsToTags < ActiveRecord::Migration
  def self.up
    Tagging.all.each do |tagging|
      # Must use array index to avoid the "belongs_to :tag"-relation
      if tagging["tag"].strip.blank?
        tagging.destroy
        next
      end
      tagging.tag = Tag.find_or_create_with_like_by_name(tagging["tag"])
      if tagging.valid?
        tagging.save!
      else
        tagging.destroy # Remove invalid taggings
      end
    end
  end

  def self.down
  end
end

{'fraction_non_alphanumeric': 0.08198489751887811, 'fraction_numerical': 0.0, 'mean_word_length': 2.9156118143459917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5216110', 'n_tokens_mistral': 301, 'n_tokens_neox': 293, 'n_words': 73}