<commit_before>define(["filters/nodefilter"], function (nodefilter) {
  return function (name, key, value, f) {
    var negate = false
    var refresh

    function run(d) {
      var o = dictGet(d, key.slice(0))

      if (f)
        o = f(o)

      return o === value ? !negate : negate
    }

    function setRefresh(f) {
      refresh = f
    }

    function draw(el) {
      if (negate)
        el.parentNode.classList.add("not")
      else
        el.parentNode.classList.remove("not")
    }

    function render(el) {
      var label = document.createElement("label")
      label.textContent = name + " "

      var strong = document.createElement("strong")
      strong.textContent = value

      draw(el)

      label.appendChild(strong)
      label.onclick = function () {
        negate = !negate

        draw(el)

        if (refresh)
          refresh()
      }

      el.appendChild(label)
    }

    return { run: nodefilter(run),
             setRefresh: setRefresh,
             render: render
           }
  }
})<commit_msg>genericnode: show negation in label<commit_after>define(["filters/nodefilter"], function (nodefilter) {
  return function (name, key, value, f) {
    var negate = false
    var refresh

    var label = document.createElement("label")
    var strong = document.createElement("strong")
    label.textContent = name + " "
    label.appendChild(strong)

    function run(d) {
      var o = dictGet(d, key.slice(0))

      if (f)
        o = f(o)

      return o === value ? !negate : negate
    }

    function setRefresh(f) {
      refresh = f
    }

    function draw(el) {
      if (negate)
        el.parentNode.classList.add("not")
      else
        el.parentNode.classList.remove("not")

      strong.textContent = (negate ? "¬" : "" ) + value
    }

    function render(el) {
      el.appendChild(label)
      draw(el)

      label.onclick = function () {
        negate = !negate

        draw(el)

        if (refresh)
          refresh()
      }
    }

    return { run: nodefilter(run),
             setRefresh: setRefresh,
             render: render
           }
  }
})
{'fraction_non_alphanumeric': 0.12205466540999058, 'fraction_numerical': 0.000942507068803016, 'mean_word_length': 1.9122085048010975, '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': '4090668', 'n_tokens_mistral': 656, 'n_tokens_neox': 650, 'n_words': 146}