<commit_before>class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  def shelfmarkToOrder(shelfmark)
    letters = shelfmark.match(/^((Folio )|(Pamph. )|(Ref. ))?[A-Z]+/)[0]

    if(letters[0..4] == "Ref. ")
      letters = letters[5..letters.length]
    #else if(inHub && letters[0..4] == "Folio. N")

    end

    #TODO: if hub, lcSection, etc
    subclass = HubLcSection.where(:letters => letters).first

    if(!subclass)
      return -1
    end



    token = Integer(subclass.token)

    digits = Integer(shelfmark.match(/(\d+)/)[0])
    digits = digits.to_s.rjust(4, "0") # add prepending 0s

    res = Float(token.to_s + '.' + digits)
    return res;
  end

end
<commit_msg>Add floating digit of precision for shelfmarks<commit_after>class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  def shelfmarkToOrder(shelfmark)
    letters = shelfmark.match(/^((Folio )|(Pamph. )|(Ref. ))?[A-Z]+/)[0]

    if(letters[0..4] == "Ref. ")
      letters = letters[5..letters.length]
    #else if(inHub && letters[0..4] == "Folio. N")

    end

    #TODO: if hub, lcSection, etc
    subclass = HubLcSection.where(:letters => letters).first

    if(!subclass)
      return -1
    end



    token = Integer(subclass.token)

    digits = Integer(shelfmark.match(/(\d+)/)[0])
    digits = digits.to_s.rjust(5, "0") # add prepending 0s

    res = Float(token.to_s + '.' + digits)
    return res;
  end

end

{'fraction_non_alphanumeric': 0.1486725663716814, 'fraction_numerical': 0.012979351032448377, 'mean_word_length': 3.1466992665036675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4926579', 'n_tokens_mistral': 630, 'n_tokens_neox': 589, 'n_words': 142}