<commit_before>class PDFContext
  attr_accessor :stack, :offset, :length, :buffer
  
  def initialize(f)
    @file = f
    self.reset
  end
  
  def reset(pos = nil, l = 100)
    @file.seek(pos) if pos
    @buffer = l > 0 ? @file.read(l) : ''
    @offset = 0
    @length = @buffer.length
    @stack = []
  end
  
  def ensure_content
    @offset >= (@length - 1) ? self.increase_length : true
  end
  
  def increase_length(l=100)<commit_msg>Added file accessor Added sane defaults for buffer and length<commit_after>class PDFContext
  attr_accessor :stack, :offset, :length, :buffer, :file
  
  def initialize(f)
    @file = f
    self.reset
    @buffer = ''
    @length = 0
  end
  
  def reset(pos = nil, l = 100)
    @file.seek(pos) if pos
    @buffer = l > 0 ? @file.read(l) : ''
    @offset = 0
    @length = @buffer.length
    @stack = []
  end
  
  def ensure_content
    @offset >= (@length - 1) ? self.increase_length : true
  end
  
  def increase_length(l=100)
{'fraction_non_alphanumeric': 0.12757201646090535, 'fraction_numerical': 0.01954732510288066, 'mean_word_length': 2.617100371747212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2323712', 'n_tokens_mistral': 371, 'n_tokens_neox': 348, 'n_words': 94}