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

  compute: (arr) ->
    arr.reduce (p, n, i) =>
      p = parseInt p.charCodeAt('0') unless i > 1
      n = parseInt n.charCodeAt('0')
      return @getNum(p + n)

  convert: (string) ->
    str = string.replace(/\.(png|jpg|gif|)$/g, "")
    stringArray = str.split('')
    return @compute(stringArray)


module.exports = new Algorhythmic()<commit_msg>Fixing the case where a single char is provided from breaking the algorithm - Also making the algorithm more verbose, for the sake of readability<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)


module.exports = new Algorhythmic()
{'fraction_non_alphanumeric': 0.1377672209026128, 'fraction_numerical': 0.011084718923198733, 'mean_word_length': 3.103896103896104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '81934', 'n_tokens_mistral': 435, 'n_tokens_neox': 418, 'n_words': 117}