<commit_before>module Checklist::Pdf::Document

  def ext
    'pdf'
  end

  def document
    # create directory for intermediate files
    tmp_dir_path = [Rails.root, "/tmp/", SecureRandom.hex(8)].join
    FileUtils.mkdir tmp_dir_path
    # copy the template to intermediate directory
    FileUtils.cp [Rails.root, "/public/latex/", "#{@input_name}.tex"].join, tmp_dir_path
    @template_tex = [tmp_dir_path, "/#{@input_name}.tex"].join
    @tmp_tex    = [tmp_dir_path, "/_#{@input_name}.tex"].join
    # create the dynamic part
    File.open(@tmp_tex, "wb") do |tex|
      yield tex
    end
    output = LatexToPdf.generate_pdf_from_file(tmp_dir_path, @input_name)
    #save output at download path
    FileUtils.cp output, @download_path
    FileUtils.rm_rf(tmp_dir_path)
  end

  def common_names_with_lng_initials(taxon_concept)
    res = ''
    unless !@english_common_names || taxon_concept.english_names.empty?
      res += " (E) #{taxon_concept.english_names.join(', ')} "
    end
    unless !@spanish_common_names || taxon_concept.spanish_names.empty?
      res += " (S) #{taxon_concept.spanish_names.join(', ')} "
    end
    unless !@french_common_names || taxon_concept.french_names.empty?
      res += " (E) #{taxon_concept.french_names.join(', ')} "
    end
    res
  end

end<commit_msg>fixed French language initial in pdfs<commit_after>module Checklist::Pdf::Document

  def ext
    'pdf'
  end

  def document
    # create directory for intermediate files
    tmp_dir_path = [Rails.root, "/tmp/", SecureRandom.hex(8)].join
    FileUtils.mkdir tmp_dir_path
    # copy the template to intermediate directory
    FileUtils.cp [Rails.root, "/public/latex/", "#{@input_name}.tex"].join, tmp_dir_path
    @template_tex = [tmp_dir_path, "/#{@input_name}.tex"].join
    @tmp_tex    = [tmp_dir_path, "/_#{@input_name}.tex"].join
    # create the dynamic part
    File.open(@tmp_tex, "wb") do |tex|
      yield tex
    end
    output = LatexToPdf.generate_pdf_from_file(tmp_dir_path, @input_name)
    #save output at download path
    FileUtils.cp output, @download_path
    FileUtils.rm_rf(tmp_dir_path)
  end

  def common_names_with_lng_initials(taxon_concept)
    res = ''
    unless !@english_common_names || taxon_concept.english_names.empty?
      res += " (E) #{taxon_concept.english_names.join(', ')} "
    end
    unless !@spanish_common_names || taxon_concept.spanish_names.empty?
      res += " (S) #{taxon_concept.spanish_names.join(', ')} "
    end
    unless !@french_common_names || taxon_concept.french_names.empty?
      res += " (F) #{taxon_concept.french_names.join(', ')} "
    end
    res
  end

end
{'fraction_non_alphanumeric': 0.1300380228136882, 'fraction_numerical': 0.0007604562737642585, 'mean_word_length': 3.648409893992933, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4315244', 'n_tokens_mistral': 951, 'n_tokens_neox': 928, 'n_words': 178}