<commit_before>
class Algorhythmic
  max: 10
  getNum: (val) ->
    newVal = val % @max + 1
    return newVal

  compute: (arr) ->
    if arr.length == 1
      char = @getCharInt(arr[0])
      return @getNum(char)

    arr.reduce (previousChar, currentChar, i) =>
      previousChar = @getCharInt(previousChar) unless i > 1
      currentChar  = @getCharInt(currentChar)
      return @getNum(previousChar + currentChar)

  getCharInt: (char) -> parseInt char.charCodeAt('0') or 0

  convert: (string) ->
    str = string.replace(/\.(png|jpg|gif|)$/g, "")
    stringArray = str.split('')
    return @compute(stringArray)<commit_msg>CharCodeAt() is much faster with an int argument. - http://jsperf.com/default-to-0-vs-0/5<commit_after>
class Algorhythmic
  max: 10
  getNum: (val) ->
    newVal = val % @max + 1
    return newVal

  compute: (arr) ->
    if arr.length == 1
      char = @getCharInt(arr[0])
      return @getNum(char)

    arr.reduce (previousChar, currentChar, i) =>
      previousChar = @getCharInt(previousChar) unless i > 1
      currentChar  = @getCharInt(currentChar)
      return @getNum(previousChar + currentChar)

  getCharInt: (char) -> parseInt char.charCodeAt(0) or 0

  convert: (string) ->
    str = string.replace(/\.(png|jpg|gif|)$/g, "")
    stringArray = str.split('')
    return @compute(stringArray)
{'fraction_non_alphanumeric': 0.1454272863568216, 'fraction_numerical': 0.01424287856071964, 'mean_word_length': 3.1076923076923078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4590255', 'n_tokens_mistral': 471, 'n_tokens_neox': 451, 'n_words': 107}