<commit_before>'use babel';

import { CompositeDisposable } from 'atom';
import request from 'request';
import fs from 'fs';

function askGeorge(text) {
  return new Promise(function(resolve, reject) {
  	var options = {
		url: 'https://www.student.cs.uwaterloo.ca/~se212/george/ask-george/cgi-bin/george.cgi/check',
		headers: {
			'Content-Type': 'text/plain'
    },
    body: text
    };
    var callback = function (err, res, body) {
      if (err || res.statusCode !== 200 || !body || !body.match) {
        reject(typeof err === 'string' ? err : 'Error getting george feedback');
        return;
      }
      //const match = body.match(/(\+-\+-\+-\+-\+-\+-\+-\+[\s\S]*?)<\/textarea>/);
      //if (!match || !match[1]) {
      // reject(typeof err === 'string' ? err : 'Error getting george feedback');
      //} else {
        resolve(body);
      //}
    };
    request.post(options, callback);
  });
}

function formatNumToStr(num) {
  // assuming two-digit strings
  return num > 10 ? `${num}` : `0${num}`;
}

function getTextForAssignmentAndProblem(asn, prob) {
  return new Promise(function(resolve, reject) {
    const aStr = formatNumToStr(asn), qStr = formatNumToStr(prob);
    const url = `https://www.student.cs.uwaterloo.ca/~se212/asn/a${aStr}grg/a${aStr}q${qStr}.grg`;
    request.get(url, (err, res, body) => {
      if (err || res.statusCode !== 200 || !body || typeof body !== 'string') {
        reject(typeof err === 'string' ? err : `Error getting assignment texts for assignment ${asn}`);<commit_msg>removed extra cmts<commit_after>'use babel';

import { CompositeDisposable } from 'atom';
import request from 'request';
import fs from 'fs';

function askGeorge(text) {
  return new Promise(function(resolve, reject) {
    //options for request, George accepts body as 'text/plain'
    var options = {
      url: 'https://www.student.cs.uwaterloo.ca/~se212/george/ask-george/cgi-bin/george.cgi/check',
      headers: {
        'Content-Type': 'text/plain'
      },
      body: text
    };

    var callback = function (err, res, body) {
      if (err || res.statusCode !== 200 || !body || !body.match) {
        reject(typeof err === 'string' ? err : 'Error getting george feedback');
        return;
      }
      resolve(body);
    };

    request.post(options, callback);
  });
}

function formatNumToStr(num) {
  // assuming two-digit strings
  return num > 10 ? `${num}` : `0${num}`;
}

function getTextForAssignmentAndProblem(asn, prob) {
  return new Promise(function(resolve, reject) {
    const aStr = formatNumToStr(asn), qStr = formatNumToStr(prob);
    const url = `https://www.student.cs.uwaterloo.ca/~se212/asn/a${aStr}grg/a${aStr}q${qStr}.grg`;
    request.get(url, (err, res, body) => {
      if (err || res.statusCode !== 200 || !body || typeof body !== 'string') {
        reject(typeof err === 'string' ? err : `Error getting assignment texts for assignment ${asn}`);
{'fraction_non_alphanumeric': 0.1791967044284243, 'fraction_numerical': 0.010641949879848954, 'mean_word_length': 3.1333333333333333, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '7442490', 'n_tokens_mistral': 1007, 'n_tokens_neox': 966, 'n_words': 226}