<commit_before>var rio,e;
rio=require("rio");
e=require("./errors");

rio.evaluateAsync=function(command,options){
  return new Promise(function(resolve,reject){
    if(!options){var options={};}
    options.callback=function(err,result){
      if(err){return reject(err);}
      return resolve(result);
    };
    return rio.evaluate(command,options);
  });
};

rio.sourceAndEvalAsync=function(filename,entryPoint,data,config){
  return new Promise(function(resolve,reject){
    if(!filename){return reject("no filename specified");}
    if(!entryPoint){return reject("no entryPoint specified");}
    var options={};
    options.entryPoint=entryPoint;
    options.data={
      r: 0,
      len: 30
    };
    if(data){_.extend(options.data,data);}
    if(config){_.extend(options,config);}
    options.callback=function(err,result){
      if(err){return reject("eval error");}
      return resolve(result);
    };
    return rio.sourceAndEval(__dirname+"/R/"+filename,options);
  });
};

exports.evaluate=function(req,res){
  return rio.evaluateAsync(req.params.command)
  .then(function(data){
    return res.send(data.toString());
  })
  .catch(e.onError(res));
};

exports.correlation=function(req,res){
  return rio.sourceAndEvalAsync("correlation.r","correlation",req.query)
  .then(function(data){
    return res.send(data);
  })
  .catch(e.onError(res));
};<commit_msg>Dateinamen-Großschreibung bei R-Dateien gefixt<commit_after>var rio,e;
rio=require("rio");
e=require("./errors");

rio.evaluateAsync=function(command,options){
  return new Promise(function(resolve,reject){
    if(!options){var options={};}
    options.callback=function(err,result){
      if(err){return reject(err);}
      return resolve(result);
    };
    return rio.evaluate(command,options);
  });
};

rio.sourceAndEvalAsync=function(filename,entryPoint,data,config){
  return new Promise(function(resolve,reject){
    if(!filename){return reject("no filename specified");}
    if(!entryPoint){return reject("no entryPoint specified");}
    var options={};
    options.entryPoint=entryPoint;
    options.data={
      r: 0,
      len: 30
    };
    if(data){_.extend(options.data,data);}
    if(config){_.extend(options,config);}
    options.callback=function(err,result){
      if(err){return reject("eval error");}
      return resolve(result);
    };
    return rio.sourceAndEval(__dirname+"/R/"+filename,options);
  });
};

exports.evaluate=function(req,res){
  return rio.evaluateAsync(req.params.command)
  .then(function(data){
    return res.send(data.toString());
  })
  .catch(e.onError(res));
};

exports.correlation=function(req,res){
  return rio.sourceAndEvalAsync("correlation.R","correlation",req.query)
  .then(function(data){
    return res.send(data);
  })
  .catch(e.onError(res));
};
{'fraction_non_alphanumeric': 0.17378815080789947, 'fraction_numerical': 0.0021543985637342907, 'mean_word_length': 4.852941176470588, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6130595', 'n_tokens_mistral': 910, 'n_tokens_neox': 889, 'n_words': 125}