<commit_before>import _ from 'lodash';
import Q from 'q';

export default {
  setContainer(container) {
    this.container = container;
    this.container.addClass(this.type);
  },

  getAnchor() {
    if (this._proxy) {
      return this._proxy.getAnchor();
    } else {
      return this._getAnchor();
    }
  },

  _getAnchor() {
    var box = this.container.getBBox();

    return {
      atype: this.type,
      ax: box.x,
      ax2: box.x2,
      ay: box.cy
    };
  },

  getBBox() {
    return _.extend(this.container.getBBox(), this.getAnchor());
  },

  normalizeBBox(box) {
    return _.extend({
      atype: 'normalize',
      ax: box.x,
      ax2: box.x2,
      ay: box.cy
    }, box);
  },

  transform(matrix) {
    return this.container.transform(matrix);
  },

  renderLabel(text) {
    var deferred = Q.defer(),
        group = this.container.group()
          .addClass('label'),
        rect = group.rect(),
        text = group.text(0, 0, text);

    setTimeout(deferred.resolve.bind(deferred, group));
    deferred.promise.then(() => {
      var box = text.getBBox(),
          margin = 5;

      text.transform(Snap.matrix()
        .translate(margin, box.height / 2 + 2 * margin));
<commit_msg>Putting all labels in a tspan.<commit_after>import _ from 'lodash';
import Q from 'q';

export default {
  setContainer(container) {
    this.container = container;
    this.container.addClass(this.type);
  },

  getAnchor() {
    if (this._proxy) {
      return this._proxy.getAnchor();
    } else {
      return this._getAnchor();
    }
  },

  _getAnchor() {
    var box = this.container.getBBox();

    return {
      atype: this.type,
      ax: box.x,
      ax2: box.x2,
      ay: box.cy
    };
  },

  getBBox() {
    return _.extend(this.container.getBBox(), this.getAnchor());
  },

  normalizeBBox(box) {
    return _.extend({
      atype: 'normalize',
      ax: box.x,
      ax2: box.x2,
      ay: box.cy
    }, box);
  },

  transform(matrix) {
    return this.container.transform(matrix);
  },

  renderLabel(text) {
    var deferred = Q.defer(),
        group = this.container.group()
          .addClass('label'),
        rect = group.rect(),
        text = group.text(0, 0, _.flatten([text]));

    setTimeout(deferred.resolve.bind(deferred, group));
    deferred.promise.then(() => {
      var box = text.getBBox(),
          margin = 5;

      text.transform(Snap.matrix()
        .translate(margin, box.height / 2 + 2 * margin));

{'fraction_non_alphanumeric': 0.15652879156528793, 'fraction_numerical': 0.0072992700729927005, 'mean_word_length': 2.2546174142480213, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7369614', 'n_tokens_mistral': 850, 'n_tokens_neox': 817, 'n_words': 165}