<commit_before># -*- coding: utf-8 -*-
class SlideParseJob < ApplicationJob
  queue_as :default

  def perform(slide, file)
    s3 = Aws::S3::Resource.new
    bucket = s3.bucket('nslides01-pages')

    images = Magick::Image.from_blob(File.open(file).read) do
      # 2000pxでサンプリングして800pxの画像に変換
      self.density  = 200
      self.geometry = 800
    end

    images.each_with_index do |img, index|
      img.format = 'PNG'
      png_data = img.to_blob
      name = SecureRandom.hex
<commit_msg>RMagickの使い方間違い修正<commit_after># -*- coding: utf-8 -*-
class SlideParseJob < ApplicationJob
  queue_as :default

  def perform(slide, file)
    s3 = Aws::S3::Resource.new
    bucket = s3.bucket('nslides01-pages')

    images = Magick::Image.from_blob(File.open(file).read) do
      # 2000pxでサンプリング
      self.density  = 200
    end

    images.each_with_index do |img, index|
      img.resize_to_fit!(800, 600)
      img.format = 'PNG'
      png_data = img.to_blob
      name = SecureRandom.hex

{'fraction_non_alphanumeric': 0.11830131445904954, 'fraction_numerical': 0.03842264914054601, 'mean_word_length': 2.8976377952755907, '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': '5265917', 'n_tokens_mistral': 403, 'n_tokens_neox': 366, 'n_words': 68}