<commit_before># coding: utf-8

module PDF
  class Reader

    # mixin for common methods in Page and FormXobjects
    #
    module ResourceMethods
      # Returns a Hash of color spaces that are available to this page
      #
      def color_spaces
        @objects.deref!(resources[:ColorSpace]) || {}
      end

      # Returns a Hash of fonts that are available to this page
      #
      def fonts
        @objects.deref!(resources[:Font]) || {}
      end

      # Returns a Hash of external graphic states that are available to this
      # page
      #
      def graphic_states
        @objects.deref!(resources[:ExtGState]) || {}
      end

      # Returns a Hash of patterns that are available to this page
      #
      def patterns
        @objects.deref!(resources[:Pattern]) || {}
      end

      # Returns an Array of procedure sets that are available to this page
      #
      def procedure_sets
        @objects.deref!(resources[:ProcSet]) || []
      end

      # Returns a Hash of properties sets that are available to this page
      #
      def properties
        @objects.deref!(resources[:Properties]) || {}
      end

      # Returns a Hash of shadings that are available to this page
      #
      def shadings
        @objects.deref!(resources[:Shading]) || {}
      end

      # Returns a Hash of XObjects that are available to this page
      #
      def xobjects
        @objects.deref!(resources[:XObject]) || {}
      end

    end
  end
end<commit_msg>add helpful not to resource methods<commit_after># coding: utf-8

module PDF
  class Reader

    # mixin for common methods in Page and FormXobjects
    #
    module ResourceMethods
      # Returns a Hash of color spaces that are available to this page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def color_spaces
        @objects.deref!(resources[:ColorSpace]) || {}
      end

      # Returns a Hash of fonts that are available to this page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def fonts
        @objects.deref!(resources[:Font]) || {}
      end

      # Returns a Hash of external graphic states that are available to this
      # page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def graphic_states
        @objects.deref!(resources[:ExtGState]) || {}
      end

      # Returns a Hash of patterns that are available to this page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def patterns
        @objects.deref!(resources[:Pattern]) || {}
      end

      # Returns an Array of procedure sets that are available to this page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def procedure_sets
        @objects.deref!(resources[:ProcSet]) || []
      end

      # Returns a Hash of properties sets that are available to this page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def properties
        @objects.deref!(resources[:Properties]) || {}
      end

      # Returns a Hash of shadings that are available to this page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def shadings
        @objects.deref!(resources[:Shading]) || {}
      end

      # Returns a Hash of XObjects that are available to this page
      #
      # NOTE: this method de-serialise objects from the underlying PDF
      #       with no caching. You will want to cache the results instead
      #       of calling it over and over.
      #
      def xobjects
        @objects.deref!(resources[:XObject]) || {}
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.06713470820535322, 'fraction_numerical': 0.00043878894251864854, 'mean_word_length': 2.003293807641634, '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': '5880703', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1137, 'n_words': 502}