<commit_before>var cover = require('tile-cover');
var ops = require('../util/ops');
var termops = require('../util/termops');
var tilebelt = require('tilebelt');
var centroid = require('turf-point-on-surface');
var DEBUG = process.env.DEBUG;

var freq;
var zoom;
var known = { term:{} };
process.on('message', function(data) {
    if (data.freq && data.zoom) {
        freq = data.freq;
        zoom = data.zoom;
    } else {
        process.send(loadDoc(data, freq, known, zoom));
    }
});

function loadDoc(doc, freq, known, zoom) {
    var patch = { grid: {}, term: {}, phrase: {}, degen: {} };
    var tiles;
    if (!doc._zxy || !doc._zxy.length) {
        tiles = cover.tiles(doc._geometry, {min_zoom: zoom, max_zoom: zoom});
        doc._zxy = [];
        tiles.forEach(function(tile){<commit_msg>Reset known cache each time setup message is sent.<commit_after>var cover = require('tile-cover');
var ops = require('../util/ops');
var termops = require('../util/termops');
var tilebelt = require('tilebelt');
var centroid = require('turf-point-on-surface');
var DEBUG = process.env.DEBUG;

var freq;
var zoom;
var known;
process.on('message', function(data) {
    if (data.freq && data.zoom) {
        freq = data.freq;
        zoom = data.zoom;
        known = { term:{} };
    } else {
        process.send(loadDoc(data, freq, known, zoom));
    }
});

function loadDoc(doc, freq, known, zoom) {
    var patch = { grid: {}, term: {}, phrase: {}, degen: {} };
    var tiles;
    if (!doc._zxy || !doc._zxy.length) {
        tiles = cover.tiles(doc._geometry, {min_zoom: zoom, max_zoom: zoom});
        doc._zxy = [];
        tiles.forEach(function(tile){
{'fraction_non_alphanumeric': 0.18411552346570398, 'fraction_numerical': 0.0, 'mean_word_length': 3.085995085995086, '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': '6178010', 'n_tokens_mistral': 557, 'n_tokens_neox': 552, 'n_words': 134}