<commit_before>// Convert numbers to words
// copyright 25th July 2006, by <NAME> http://javascript.about.com
// permission to use this Javascript on your web page is granted
// provided that all of the code (including this copyright notice) is
// used exactly as shown (you can change the numbering system if you wish)

// American Numbering System
var th = ['','thousand','million', 'billion','trillion'];
// uncomment this line for English Number System
// var th = ['','thousand','million', 'milliard','billion'];

var dg = ['zero','one','two','three','four','five','six','seven','eight','nine']; 
var tn = ['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']; 
var tw = ['twenty','thirty','fourty','fifty', 'sixty','seventy','eighty','ninety']; 

var calc = function(s){
  
  s = s.toString(); 
  s = s.replace(/[\, ]/g,''); 
  if (s != parseFloat(s)) return 'not a number'; 
  var x = s.indexOf('.'); 
  if (x == -1) x = s.length; 
  if (x > 15) return 'too big'; 
  var n = s.split(''); 
  var str = ''; var sk = 0; 
  for (var i=0; i < x; i++) {
    if ((x-i)%3==2) {
      if (n[i] == '1') {
        str += tn[Number(n[i+1])] + ' '; 
        i++; 
        sk=1;
      } else if (n[i]!=0) {
        str += tw[n[i]-2] + ' ';
        sk=1;
      }
    } else if (n[i]!=0) {
      str += dg[n[i]] +' '; 
      if ((x-i)%3==0) str += 'hundred ';
      sk=1;
    } 
    if ((x-i)%3==1) {
      if (sk) str += th[(x-i-1)/3] + ' ';
      sk=0;
    }
  } 
  if (x != s.length) {
    var y = s.length; 
    str += 'point '; 
    for (var i=x+1; i<y; i++) str += dg[n[i]] +' ';
  } 

  str = str.trim();

  return str;
}

module.exports.calc = calc;<commit_msg>fixed word space issue on point<commit_after>// Convert numbers to words
// copyright 25th July 2006, by <NAME> http://javascript.about.com
// permission to use this Javascript on your web page is granted
// provided that all of the code (including this copyright notice) is
// used exactly as shown (you can change the numbering system if you wish)

// American Numbering System
var th = ['','thousand','million', 'billion','trillion'];
// uncomment this line for English Number System
// var th = ['','thousand','million', 'milliard','billion'];

var dg = ['zero','one','two','three','four','five','six','seven','eight','nine']; 
var tn = ['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']; 
var tw = ['twenty','thirty','fourty','fifty', 'sixty','seventy','eighty','ninety']; 

var calc = function(s){
  
  s = s.toString(); 
  s = s.replace(/[\, ]/g,''); 
  if (s != parseFloat(s)) return 'not a number'; 
  var x = s.indexOf('.'); 
  if (x == -1) x = s.length; 
  if (x > 15) return 'too big'; 
  var n = s.split(''); 
  var str = ''; var sk = 0; 
  for (var i=0; i < x; i++) {
    if ((x-i)%3==2) {
      if (n[i] == '1') {
        str += tn[Number(n[i+1])] + ' '; 
        i++; 
        sk=1;
      } else if (n[i]!=0) {
        str += tw[n[i]-2] + ' ';
        sk=1;
      }
    } else if (n[i]!=0) {
      str += dg[n[i]] +' '; 
      if ((x-i)%3==0) str += 'hundred ';
      sk=1;
    } 
    if ((x-i)%3==1) {
      if (sk) str += th[(x-i-1)/3] + ' ';
      sk=0;
    }
  } 
  if (x != s.length) {
    var y = s.length; 
    str += 'point '; 
    for (var i=x+1; i<y; i++) str += dg[n[i]] +' ';
  } 
  
  str = str.replace('  ', ' ');
  str = str.trim();

  return str;
}

module.exports.calc = calc;
{'fraction_non_alphanumeric': 0.23414071510957324, 'fraction_numerical': 0.016724336793540944, 'mean_word_length': 2.738146551724138, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '6028651', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1305, 'n_words': 348}