<commit_before>module ApplicationHelper
  def display_base_errors(resource)
    return "" if (resource.errors.empty?) || (resource.errors[:base].empty?)
    messages = resource.errors[:base].map { |msg| content_tag(:p, msg) }.join
    html = <<-HTML
    <div class="alert alert-error alert-block">
      <button type="button" class="close" data-dismiss="alert">&#215;</button>
      #{messages}
    </div>
    HTML
    html.html_safe
  end

  def govspeak(text)
    Govspeak::Document.new(text).to_sanitized_html_without_images.html_safe if text
  end

  def user_needs_links(ids)
    maslow = Plek.current.find("maslow")
    Array.wrap(ids).map do |id|
      link_to(id, maslow + "/needs/#{id}", target: "_blank")
    end.join(", ").html_safe
  end

  def content_organisations(organisations)
    organisations.map(&:abbreviation_or_name).join ", "
  end<commit_msg>Dont break if need_api is down<commit_after>module ApplicationHelper
  def display_base_errors(resource)
    return "" if (resource.errors.empty?) || (resource.errors[:base].empty?)
    messages = resource.errors[:base].map { |msg| content_tag(:p, msg) }.join
    html = <<-HTML
    <div class="alert alert-error alert-block">
      <button type="button" class="close" data-dismiss="alert">&#215;</button>
      #{messages}
    </div>
    HTML
    html.html_safe
  end

  def govspeak(text)
    Govspeak::Document.new(text).to_sanitized_html_without_images.html_safe if text
  end

  def user_needs_links(ids)
    maslow = Plek.current.find("maslow")
    Array.wrap(ids).map do |id|
      link_to(id, maslow + "/needs/#{id}", target: "_blank")
    end.join(", ").html_safe
  end

  def content_organisations(organisations)
    return if organisations.compact.empty?
    organisations.map(&:abbreviation_or_name).join ", "
  end
{'fraction_non_alphanumeric': 0.14659977703455965, 'fraction_numerical': 0.0033444816053511705, 'mean_word_length': 3.9449035812672175, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, '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': '4870943', 'n_tokens_mistral': 616, 'n_tokens_neox': 598, 'n_words': 115}