<commit_before>require 'virtus'

module FFSplitter
  class ChapterList

    include Enumerable

    def initialize
      @chapters = []
    end

    def self.from_metadata(metadata)
      list = new
      metadata.each { |c| list.add(c) }
      list
    end

    def each(&block)
      @chapters.each { |c| yield c }
    end

    def add(chapter)
      chapter.list = self
      @chapters << chapter
    end
  end

  class Chapter
    include Virtus.model

    attribute :start_frames, Integer, default: 0
    attribute :end_frames, Integer, default: 0
    attribute :timebase, Float, default: 1/30000
    attribute :title, String

    attr_accessor :list

    def start_time
      timebase * start_frames
    end

    def end_time
      timebase * end_frames
    end<commit_msg>Remove need for Chapter.from_metadata<commit_after>require 'virtus'

module FFSplitter
  class ChapterList

    include Enumerable

    def initialize
      @chapters = []
    end

    def each(&block)
      @chapters.each { |c| yield c }
    end

    def add(chapter)
      chapter.list = self
      @chapters << chapter
    end
  end

  class Chapter
    include Virtus.model

    attribute :start_frames, Integer, default: 0
    attribute :end_frames, Integer, default: 0
    attribute :timebase, Float, default: 1/30000
    attribute :title, String

    attr_accessor :list

    def start_time
      timebase * start_frames
    end

    def end_time
      timebase * end_frames
    end
{'fraction_non_alphanumeric': 0.06880108991825613, 'fraction_numerical': 0.010899182561307902, 'mean_word_length': 2.4083526682134573, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6312016', 'n_tokens_mistral': 475, 'n_tokens_neox': 437, 'n_words': 133}