<commit_before>module Twine
  class StringsSection
    attr_reader :name
    attr_reader :rows

    def initialize(name)
      @name = name
      @rows = []
    end
  end

  class StringsRow
    attr_reader :key
    attr_accessor :comment
    attr_accessor :tags
    attr_reader :translations
    attr_accessor :reference
    attr_accessor :reference_key

    def initialize(key)
      @key = key
      @comment = nil
      @tags = nil
      @translations = {}
    end

    def comment
      raw_comment || (reference.comment if reference)
    end

    def raw_comment
      @comment
    end

    def matches_tags?(tags, include_untagged)
      if tags == nil || tags.empty?
        # The user did not specify any tags. Everything passes.
        return true
      elsif @tags == nil
        # This row has no tags.
        return reference ? reference.matches_tags?(tags, include_untagged) : include_untagged
      elsif @tags.empty?
        return include_untagged
      else
        tags.each do |tag|
          if @tags.include? tag
            return true
          end
        end
      end

      return false
    end
<commit_msg>Shortened expression to check if a StringsRow matches a given set of tags.<commit_after>module Twine
  class StringsSection
    attr_reader :name
    attr_reader :rows

    def initialize(name)
      @name = name
      @rows = []
    end
  end

  class StringsRow
    attr_reader :key
    attr_accessor :comment
    attr_accessor :tags
    attr_reader :translations
    attr_accessor :reference
    attr_accessor :reference_key

    def initialize(key)
      @key = key
      @comment = nil
      @tags = nil
      @translations = {}
    end

    def comment
      raw_comment || (reference.comment if reference)
    end

    def raw_comment
      @comment
    end

    def matches_tags?(tags, include_untagged)
      if tags == nil || tags.empty?
        # The user did not specify any tags. Everything passes.
        return true
      elsif @tags == nil
        # This row has no tags.
        return reference ? reference.matches_tags?(tags, include_untagged) : include_untagged
      elsif @tags.empty?
        return include_untagged
      else
        return !(tags & @tags).empty?
      end

      return false
    end

{'fraction_non_alphanumeric': 0.0636042402826855, 'fraction_numerical': 0.0, 'mean_word_length': 2.0984952120383036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6684869', 'n_tokens_mistral': 661, 'n_tokens_neox': 643, 'n_words': 205}