<commit_before>import util from 'util';
import path from 'path';

import eventCategories from 'common/analytics/categories';
import eventActions from 'common/analytics/actions';
import eventNames from 'common/analytics/names';

function anonymizeException (err) {
  const app = require('common/electron/app').default;
  err.message = err.message.replace(app.getPath('home'), '<home>');
}

function namespaceOfFile (filename) {
  const app = require('common/electron/app').default;
  const appPath = path.join(app.getAppPath(), 'scripts') + '/';

  const appPathNorm = path.posix.normalize(appPath);
  const filenameNorm = path.posix.normalize(filename);

  let name = filenameNorm.replace(appPathNorm, '').replace('.js', '');
  if (name.startsWith('common/')) {
    name += ':' + process.type;
  }

  return global.manifest.name + ':' + name;<commit_msg>Fix namespaceOfFile for Windows<commit_after>import util from 'util';
import path from 'path';

import eventCategories from 'common/analytics/categories';
import eventActions from 'common/analytics/actions';
import eventNames from 'common/analytics/names';

function anonymizeException (err) {
  const app = require('common/electron/app').default;
  err.message = err.message.replace(app.getPath('home'), '<home>');
}

function namespaceOfFile (filename) {
  const app = require('common/electron/app').default;
  const appPath = path.join(app.getAppPath(), 'scripts') + path.sep;

  let name = filename
    .replace(appPath, '')
    .replace(/\\/g, '/')
    .replace('.js', '');

  if (name.startsWith('common/')) {
    name += ':' + process.type;
  }

  return global.manifest.name + ':' + name;
{'fraction_non_alphanumeric': 0.16303030303030303, 'fraction_numerical': 0.0, 'mean_word_length': 4.813380281690141, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3292166', 'n_tokens_mistral': 513, 'n_tokens_neox': 497, 'n_words': 111}