<commit_before>class DutyExpressionFormatter

  def self.prettify(float)
    float.to_i == float ? float.to_i : float
  end

  def self.format(opts={})
    duty_expression_id = opts[:duty_expression_id]
    duty_expression_description = opts[:duty_expression_description]
    duty_expression_abbreviation = opts[:duty_expression_abbreviation]
    duty_amount = opts[:duty_amount]
    monetary_unit = opts[:monetary_unit]
    measurement_unit = opts[:measurement_unit]
    measurement_unit_qualifier = opts[:measurement_unit_qualifier]

    @formatted = ""

    case duty_expression_id
    when "99"
      @formatted << measurement_unit
    when "12", "14", "37", "40", "41", "42", "43", "44", "21", "25", "27", "29"
      if duty_expression_abbreviation.present?
        @formatted << duty_expression_abbreviation
      elsif duty_expression_description.present?
        @formatted << duty_expression_description
      end
    when "04", "15", "17", "19", "20"
      if duty_expression_abbreviation.present?
        @formatted << duty_expression_abbreviation
      elsif duty_expression_description.present?
        @formatted << duty_expression_description
      end
      if duty_amount.present?
        @formatted << " " << prettify(duty_amount).to_s
      end
      if monetary_unit.present?
        @formatted << " #{monetary_unit}"
      else
        @formatted << " %"
      end
      if measurement_unit.present? && measurement_unit_qualifier.present?
        @formatted << " / (#{measurement_unit}/#{measurement_unit_qualifier})"
      elsif measurement_unit.present?
        @formatted << " / #{measurement_unit}"
      end
    else
      if duty_amount.present?<commit_msg>hopefully fix other incorrectly formatted duty expressions<commit_after>class DutyExpressionFormatter

  def self.prettify(float)
    float.to_i == float ? float.to_i : float
  end

  def self.format(opts={})
    duty_expression_id = opts[:duty_expression_id]
    duty_expression_description = opts[:duty_expression_description]
    duty_expression_abbreviation = opts[:duty_expression_abbreviation]
    duty_amount = opts[:duty_amount]
    monetary_unit = opts[:monetary_unit]
    measurement_unit = opts[:measurement_unit]
    measurement_unit_qualifier = opts[:measurement_unit_qualifier]

    @formatted = ""

    case duty_expression_id
    when "99"
      @formatted << measurement_unit
    when "12", "14", "37", "40", "41", "42", "43", "44", "21", "25", "27", "29"
      if duty_expression_abbreviation.present?
        @formatted << duty_expression_abbreviation
      elsif duty_expression_description.present?
        @formatted << duty_expression_description
      end
    when "02", "04", "15", "17", "19", "20", "36"
      if duty_expression_abbreviation.present?
        @formatted << duty_expression_abbreviation
      elsif duty_expression_description.present?
        @formatted << duty_expression_description
      end
      if duty_amount.present?
        @formatted << " " << prettify(duty_amount).to_s
      end
      if monetary_unit.present?
        @formatted << " #{monetary_unit}"
      else
        @formatted << " %"
      end
      if measurement_unit.present? && measurement_unit_qualifier.present?
        @formatted << " / (#{measurement_unit}/#{measurement_unit_qualifier})"
      elsif measurement_unit.present?
        @formatted << " / #{measurement_unit}"
      end
    else
      if duty_amount.present?
{'fraction_non_alphanumeric': 0.11036496350364963, 'fraction_numerical': 0.02218978102189781, 'mean_word_length': 3.4784313725490197, 'pattern_counts': {'":': 0, '<': 47, '<?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': '6804766', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1031, 'n_words': 195}