<commit_before>'use strict'
var Observable = require('vigour-js/lib/observable')
var SubsEmitter = require('vigour-js/lib/observable/subscribe/constructor')
var Protocol = require('../../protocol')
var Event = require('vigour-js/lib/event')
var hash = require('vigour-js/lib/util/hash')
var isEmpty = require('vigour-js/lib/util/is/empty')

module.exports = function (syncable, event) {
  var Syncable = syncable.Constructor
  exports.properties = {
    subsrefs: true,
    subsmap: true
  }
  exports.define = {
    syncPath: {
      get () {
        var parent = this
        var path = []
        while (parent && parent.key && !parent.adapter) {
          path.unshift(parent.key)
          parent = parent._parent
        }
        return path
      }
    },
    onSubRemove (emitter) {
      if (!this.substore) {
        return
      }
      let path = emitter._path.join('.')
      let hashed = this.substore[path]
      if (hashed) {
        delete this.substore[path]
        if (isEmpty(this.substore)) {
          delete this.substore
        }
        if (this.subscollectors && this.subscollectors[hashed]) {
          this.subscollectors[hashed]--
          if (!this.subscollectors[hashed]) {
            this.sendUpstream(void 0, event, { unsubscribe: { val: [ hashed ], path: this.syncPath } })
            delete this.subscollectors[hashed]
            if (isEmpty(this.subscollectors)) {
              delete this.subscollectors
            }
          }
        }
      }
    },
    onSub (data, event, emitter, pattern, current, mapvalue, map, context) {
      var genpath = emitter.path.join('.')
      console.log('pattern', pattern)
      if (this.substore && this.substore[genpath]) {<commit_msg>added event<commit_after>'use strict'
var Observable = require('vigour-js/lib/observable')
var SubsEmitter = require('vigour-js/lib/observable/subscribe/constructor')
var Protocol = require('../../protocol')
var Event = require('vigour-js/lib/event')
var hash = require('vigour-js/lib/util/hash')
var isEmpty = require('vigour-js/lib/util/is/empty')

module.exports = function (syncable, event) {
  var Syncable = syncable.Constructor
  exports.properties = {
    subsrefs: true,
    subsmap: true
  }
  exports.define = {
    syncPath: {
      get () {
        var parent = this
        var path = []
        while (parent && parent.key && !parent.adapter) {
          path.unshift(parent.key)
          parent = parent._parent
        }
        return path
      }
    },
    onSubRemove (emitter, event) {
      if (!this.substore) {
        return
      }
      let path = emitter._path.join('.')
      let hashed = this.substore[path]
      if (hashed) {
        delete this.substore[path]
        if (isEmpty(this.substore)) {
          delete this.substore
        }
        if (this.subscollectors && this.subscollectors[hashed]) {
          this.subscollectors[hashed]--
          if (!this.subscollectors[hashed]) {
            this.sendUpstream(void 0, event, { unsubscribe: { val: [ hashed ], path: this.syncPath } })
            delete this.subscollectors[hashed]
            if (isEmpty(this.subscollectors)) {
              delete this.subscollectors
            }
          }
        }
      }
    },
    onSub (data, event, emitter, pattern, current, mapvalue, map, context) {
      var genpath = emitter.path.join('.')
      console.log('pattern', pattern)
      if (this.substore && this.substore[genpath]) {
{'fraction_non_alphanumeric': 0.13308205276891852, 'fraction_numerical': 0.0005798782255726297, 'mean_word_length': 2.23943661971831, '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': '2325922', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1079, 'n_words': 212}