<commit_before>module Honk
  class Post
    yaml_as "tag:honk.yapok.org,2009:Post"

    attr_accessor :title, :timestamp, :contents, :commentable, :tags,
                  :slug,  :file

    def yaml_initialize(tag, params)
      initialize_attributes params
    end

    def initialize(params={})
      params[:timestamp] ||= Time.now
      initialize_attributes params
    end

    def comments
      if @comments.nil?
        begin
          comment_file = Honk.root / 'posts' / @file.gsub(/\.yml$/, '.comments.yml')
          if File.exist? comment_file
            @comments = YAML.load_stream(File.read(comment_file)).documents
          else [] end
        rescue NoMethodError, FileFormatError
          []
        end
      else @comments end
    end

    def to_yaml_properties
      %w[@title @tags @timestamp @commentable @contents]
    end

    def to_yaml(opts)
      YAML.quick_emit(object_id, opts) do |out|
        out.map(taguri, to_yaml_style) do |map|<commit_msg>add post abstract<commit_after>module Honk
  class Post
    yaml_as "tag:honk.yapok.org,2009:Post"

    attr_accessor :title, :timestamp, :contents, :commentable, :abstract,
                  :tags, :slug, :file

    def yaml_initialize(tag, params)
      initialize_attributes params
    end

    def initialize(params={})
      params[:timestamp] ||= Time.now
      initialize_attributes params
    end

    def comments
      if @comments.nil?
        begin
          comment_file = Honk.root / 'posts' / @file.gsub(/\.yml$/, '.comments.yml')
          if File.exist? comment_file
            @comments = YAML.load_stream(File.read(comment_file)).documents
          else [] end
        rescue NoMethodError, FileFormatError
          []
        end
      else @comments end
    end

    def to_yaml_properties
      %w[@title @tags @timestamp @commentable @contents]
    end

    def to_yaml(opts)
      YAML.quick_emit(object_id, opts) do |out|
        out.map(taguri, to_yaml_style) do |map|
{'fraction_non_alphanumeric': 0.10202020202020202, 'fraction_numerical': 0.00404040404040404, 'mean_word_length': 2.363327674023769, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2707857', 'n_tokens_mistral': 629, 'n_tokens_neox': 597, 'n_words': 142}