<commit_before>const DEVELOPMENT_SERVER_ADDRESS = "http://localhost:8000";
const PRODUCTION_SERVER_ADDRESS = "";

export function extractFromResource(
  property: string,
  resource: string
): string {
  const sliceLen = `/${property}/`.length;
  const pattern = `/${property}/[^/]*`;
  const regex = new RegExp(pattern);

  const found = regex.exec(resource);
  if (found === null) throw `couldn't parse resource identifier: ${resource}`;

  const result = found[0].slice(sliceLen);
  return result;
}

export function delay(miliseconds: number) {
  return new Promise(resolve => setTimeout(resolve, miliseconds));
}

export function getServerAddress(): string {
  if (process.env.NODE_ENV === "development") {
    return DEVELOPMENT_SERVER_ADDRESS;
  }

  return PRODUCTION_SERVER_ADDRESS;
}
<commit_msg>Temporary fix for snapshot recommendation parsing<commit_after>const DEVELOPMENT_SERVER_ADDRESS = "http://localhost:8000";
const PRODUCTION_SERVER_ADDRESS = "";

export function extractFromResource(
  property: string,
  resource: string
): string {
  const sliceLen = `/${property}/`.length;
  const pattern = `/${property}/[^/]*`;
  const regex = new RegExp(pattern);

  const found = regex.exec(resource);
  if (found === null) {
    // TODO: this function doesn't support snapshots, so I have temporarily disabled errors
    return "NOT IMPLEMENTED";
    //throw `couldn't parse resource identifier: ${resource}`;
  }

  const result = found[0].slice(sliceLen);
  return result;
}

export function delay(miliseconds: number) {
  return new Promise(resolve => setTimeout(resolve, miliseconds));
}

export function getServerAddress(): string {
  if (process.env.NODE_ENV === "development") {
    return DEVELOPMENT_SERVER_ADDRESS;
  }

  return PRODUCTION_SERVER_ADDRESS;
}

{'fraction_non_alphanumeric': 0.12794612794612795, 'fraction_numerical': 0.005611672278338945, 'mean_word_length': 4.983221476510067, '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': '7120497', 'n_tokens_mistral': 534, 'n_tokens_neox': 514, 'n_words': 140}