<commit_before>require "mail"
require 'forwardable'

module Glima
  module Resource
    class Mail < ::Mail::Message
      extend Forwardable

      def_delegators :@gmail_message,
      # Users.histoy
      :internal_date,
      :snippet

      def self.read(mail_filename)
        new(File.open(filename, 'rb') {|f| f.read })
      end

      def initialize(message)
        @gmail_message = message
        super(message.raw)
      end

      def gm_msgid
        @gmail_message.id
      end
      alias_method :id, :gm_msgid

      def gm_thrid
        @gmail_message.thread_id
      end
      alias_method :thread_id, :gm_thrid

      def gm_label_ids
        @gmail_message.label_ids
      end
      alias_method :label_ids, :gm_label_ids

      def raw
        @gmail_message.raw
      end

      def to_plain_text<commit_msg>Fix typo<commit_after>require "mail"
require 'forwardable'

module Glima
  module Resource
    class Mail < ::Mail::Message
      extend Forwardable

      def_delegators :@gmail_message,
      # Users.histoy
      :internal_date,
      :snippet

      def self.read(mail_filename)
        new(File.open(mail_filename, 'rb') {|f| f.read })
      end

      def initialize(message)
        @gmail_message = message
        super(message.raw)
      end

      def gm_msgid
        @gmail_message.id
      end
      alias_method :id, :gm_msgid

      def gm_thrid
        @gmail_message.thread_id
      end
      alias_method :thread_id, :gm_thrid

      def gm_label_ids
        @gmail_message.label_ids
      end
      alias_method :label_ids, :gm_label_ids

      def raw
        @gmail_message.raw
      end

      def to_plain_text
{'fraction_non_alphanumeric': 0.07202881152460984, 'fraction_numerical': 0.0, 'mean_word_length': 2.110074626865672, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2613781', 'n_tokens_mistral': 555, 'n_tokens_neox': 528, 'n_words': 116}