<commit_before>
var Stream = require('stream')

var d3 = require('d3')
var through = require('through')
var parse = require('event-stream').parse

var livebezier = function(opts) {

  var stream = new Stream
  stream.writable = true

  var svg = d3
    .select('body')
      .append('svg')

  svg
    .attr('id', 'background')
    .attr('width', opts.clientWidth)
    .attr('height', opts.clientHeight)

  var p = svg.append('path')

  stream.vectors = []

  function write(data) {
    data = data || []
 
    if (typeof data[0] !== 'number') {
      for (var i = 0, l = data.length; i < l; i++) {
        stream.vectors.push(data[i])
      }
    }
    else {
      stream.vectors.push(data)
    }
 
    var x = d3
      .scale
      .linear()
      .domain([0, opts.domainWidth])
      .range([0, opts.clientWidth])
    ;

    var y = d3
      .scale
      .linear()
      .domain([0, opts.domainHeight])
      .range([opts.clientHeight, 0])
    ;

    p
      .datum(stream.vectors)
      .attr('d', d3
        .svg
        .line()
        .interpolate('basis')
        .x(function(d) { return x(d[0]); })
        .y(function(d) { return y(d[1]); })
      )
    ;

    this.queue(svg.select('path').attr('d'))
  }
  var ts = through(write)

  ts.vectors = stream.vectors
  ts.write = write
<commit_msg>Can't call it write.<commit_after>
var Stream = require('stream')

var d3 = require('d3')
var through = require('through')
var parse = require('event-stream').parse

var livebezier = function(opts) {

  var stream = new Stream
  stream.writable = true

  var svg = d3
    .select('body')
      .append('svg')

  svg
    .attr('id', 'background')
    .attr('width', opts.clientWidth)
    .attr('height', opts.clientHeight)

  var p = svg.append('path')

  stream.vectors = []

  function write(data) {
    data = data || []
 
    if (typeof data[0] !== 'number') {
      for (var i = 0, l = data.length; i < l; i++) {
        stream.vectors.push(data[i])
      }
    }
    else {
      stream.vectors.push(data)
    }
 
    var x = d3
      .scale
      .linear()
      .domain([0, opts.domainWidth])
      .range([0, opts.clientWidth])
    ;

    var y = d3
      .scale
      .linear()
      .domain([0, opts.domainHeight])
      .range([opts.clientHeight, 0])
    ;

    p
      .datum(stream.vectors)
      .attr('d', d3
        .svg
        .line()
        .interpolate('basis')
        .x(function(d) { return x(d[0]); })
        .y(function(d) { return y(d[1]); })
      )
    ;

    this.queue(svg.select('path').attr('d'))
  }
  var ts = through(write)

  ts.vectors = stream.vectors
  ts.draw = write

{'fraction_non_alphanumeric': 0.1729150726855394, 'fraction_numerical': 0.010711553175210406, 'mean_word_length': 2.094674556213018, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1473299', 'n_tokens_mistral': 954, 'n_tokens_neox': 904, 'n_words': 197}