<commit_before>import Superagent from 'superagent';
import _ from 'lodash';
import 'babel/polyfill';

export class Client {
  constructor(params = {}) {
    params.api_version = params.api_version || 1;
    this.params = params;
    if(params.domain.match(/http/)) this.url_prefix = `${params.domain}/api/v${params.api_version}/`
    else this.url_prefix = `http://${params.domain}.dev.montagehot.club/api/v${params.api_version}/`
  }
  schemas() {
    return this.request(`schemas/`);
  }
  schema(name) {
    return this.request(`schemas/${name}/`);
  }
  documents(schema, query) {
    var params = query ? query.toJS() : {};
    return this.request(`schemas/${schema}/query/`, "POST", params);
  }
  document(schema, document_uuid) {
    return this.request(`schemas/${schema}/${document_uuid}/`);
  }
  document_cursor(schema, cursor) {
    var params = {cursor};
    return this.request(`schemas/${schema}/`, "GET", params);
  }
  *chunked_document_cursor(schema, cursor) {
    while (cursor) {
      yield this.raw_document_cursor(schema, cursor).then(payload => {
        try {<commit_msg>that was a bad way of specifying the url<commit_after>import Superagent from 'superagent';
import _ from 'lodash';
import 'babel/polyfill';

export class Client {
  constructor(params = {}) {
    params.api_version = params.api_version || 1;
    this.params = params;
    if (this.params.url) {
      this.url_prefix = this.params.url;
    } else {
      this.url_prefix = `http://${params.domain}.dev.montagehot.club/api/v${params.api_version}/`;
    }
  }
  schemas() {
    return this.request(`schemas/`);
  }
  schema(name) {
    return this.request(`schemas/${name}/`);
  }
  documents(schema, query) {
    var params = query ? query.toJS() : {};
    return this.request(`schemas/${schema}/query/`, "POST", params);
  }
  document(schema, document_uuid) {
    return this.request(`schemas/${schema}/${document_uuid}/`);
  }
  document_cursor(schema, cursor) {
    var params = {cursor};
    return this.request(`schemas/${schema}/`, "GET", params);
  }
  *chunked_document_cursor(schema, cursor) {
    while (cursor) {
      yield this.raw_document_cursor(schema, cursor).then(payload => {
        try {
{'fraction_non_alphanumeric': 0.17006802721088435, 'fraction_numerical': 0.0009070294784580499, 'mean_word_length': 3.66384778012685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1915249', 'n_tokens_mistral': 716, 'n_tokens_neox': 713, 'n_words': 131}