<commit_before>module Gnoibox
  class Axis
    # MATCH_TYPES = [:equal, :range, :month, :age, :prefecture, :city, :railway, :station, :custom]

    class << self
      attr_reader :key, :label

      def set_key(key, label)
        Gnoibox::AxisCollection.add self
        @key = key.to_sym
        @label = label
      end

      def set_label(v) @label=v end

      def set_type(type)
        # deprecated
        # use include Gnoibox::Axis::Type::Range instead
      end
      def type
        :equal
      end

      def set_option(key, label, settings={})
        options << Option.new(key, label, settings)
      end

      def options
        @options ||= []
      end
      def option_keys
        options.map(&:key)
      end
      def option_hash
        @option_hash ||= options.index_by(&:key)
      end
      def option(key)
        option_hash[key.to_sym]
      end
      
      def tag_for(v)
        option_keys.include?(v.to_sym) ? v :nil
      end
      
    end<commit_msg>fix Gnoibox::Axis#tag_for<commit_after>module Gnoibox
  class Axis
    # MATCH_TYPES = [:equal, :range, :month, :age, :prefecture, :city, :railway, :station, :custom]

    class << self
      attr_reader :key, :label

      def set_key(key, label)
        Gnoibox::AxisCollection.add self
        @key = key.to_sym
        @label = label
      end

      def set_label(v) @label=v end

      def set_type(type)
        # deprecated
        # use include Gnoibox::Axis::Type::Range instead
      end
      def type
        :equal
      end

      def set_option(key, label, settings={})
        options << Option.new(key, label, settings)
      end

      def options
        @options ||= []
      end
      def option_keys
        options.map(&:key)
      end
      def option_hash
        @option_hash ||= options.index_by(&:key)
      end
      def option(key)
        option_hash[key.to_sym]
      end
      
      def tag_for(v)
        option_keys.include?(v.to_sym) ? v : nil
      end
      
    end
{'fraction_non_alphanumeric': 0.10455227613806903, 'fraction_numerical': 0.0, 'mean_word_length': 1.8694404591104734, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2852970', 'n_tokens_mistral': 667, 'n_tokens_neox': 652, 'n_words': 156}