<commit_before>define(
  'ephox.darwin.selection.CellSelection',

  [
    'ephox.compass.Arr',
    'ephox.darwin.api.Ephemera',
    'ephox.peanut.Fun',
    'ephox.perhaps.Option',
    'ephox.robin.api.dom.DomParent',
    'ephox.snooker.api.TablePositions',
    'ephox.sugar.api.Class',
    'ephox.sugar.api.OnNode',
    'ephox.sugar.api.SelectorFilter',
    'ephox.sugar.api.SelectorFind'
  ],

  function (Arr, Ephemera, Fun, Option, DomParent, TablePositions, Class, OnNode, SelectorFilter, SelectorFind) {
    var selectedClass = '.' + Ephemera.selectedClass();
    var removeSelectionClasses = OnNode.removeClasses([ Ephemera.selectedClass(), Ephemera.lastSelectedClass(), Ephemera.firstSelectedClass() ]);

    var clear = function (container) {
      var sels = SelectorFilter.descendants(container, selectedClass);
      Arr.each(sels, removeSelectionClasses);
    };

    var select = function (cells) {
      Arr.each(cells, OnNode.addClass(Ephemera.selectedClass()));
    };

    var lookupTable = function (container) {
      return SelectorFind.ancestor(container, 'table');
    };

    var identify = function (start, finish) {
      return DomParent.sharedOne(lookupTable, [ start, finish ]).bind(function (tbl) {
        return TablePositions.intercepts(tbl, start, finish);
      });
    };

    var retrieve = function (container) {
      var sels = SelectorFilter.descendants(container, selectedClass);
      return sels.length > 0 ? Option.some(sels) : Option.none();
    };

    var getLast = function (boxes) {
      var raw = Arr.find(boxes, OnNode.hasClass(Ephemera.lastSelectedClass()));
      return Option.from(raw);
    };

    var getEdges = function (container) {
      return SelectorFind.descendant(container, '.' + Ephemera.firstSelectedClass()).bind(function (first) {
        return SelectorFind.descendant(container, '.' + Ephemera.lastSelectedClass()).bind(function (last) {
          return DomParent.sharedOne(lookupTable, [ first, last ]).map(function (tbl) {
            return {<commit_msg>Extract constant<commit_after>define(
  'ephox.darwin.selection.CellSelection',

  [
    'ephox.compass.Arr',
    'ephox.darwin.api.Ephemera',
    'ephox.peanut.Fun',
    'ephox.perhaps.Option',
    'ephox.robin.api.dom.DomParent',
    'ephox.snooker.api.TablePositions',
    'ephox.sugar.api.Class',
    'ephox.sugar.api.OnNode',
    'ephox.sugar.api.SelectorFilter',
    'ephox.sugar.api.SelectorFind'
  ],

  function (Arr, Ephemera, Fun, Option, DomParent, TablePositions, Class, OnNode, SelectorFilter, SelectorFind) {
    var selectedClass = '.' + Ephemera.selectedClass();
    var addSelectionClass = OnNode.addClass(Ephemera.selectedClass());
    var removeSelectionClasses = OnNode.removeClasses([ Ephemera.selectedClass(), Ephemera.lastSelectedClass(), Ephemera.firstSelectedClass() ]);

    var clear = function (container) {
      var sels = SelectorFilter.descendants(container, selectedClass);
      Arr.each(sels, removeSelectionClasses);
    };

    var select = function (cells) {
      Arr.each(cells, addSelectionClass);
    };

    var lookupTable = function (container) {
      return SelectorFind.ancestor(container, 'table');
    };

    var identify = function (start, finish) {
      return DomParent.sharedOne(lookupTable, [ start, finish ]).bind(function (tbl) {
        return TablePositions.intercepts(tbl, start, finish);
      });
    };

    var retrieve = function (container) {
      var sels = SelectorFilter.descendants(container, selectedClass);
      return sels.length > 0 ? Option.some(sels) : Option.none();
    };

    var getLast = function (boxes) {
      var raw = Arr.find(boxes, OnNode.hasClass(Ephemera.lastSelectedClass()));
      return Option.from(raw);
    };

    var getEdges = function (container) {
      return SelectorFind.descendant(container, '.' + Ephemera.firstSelectedClass()).bind(function (first) {
        return SelectorFind.descendant(container, '.' + Ephemera.lastSelectedClass()).bind(function (last) {
          return DomParent.sharedOne(lookupTable, [ first, last ]).map(function (tbl) {
            return {
{'fraction_non_alphanumeric': 0.13570038910505836, 'fraction_numerical': 0.00048638132295719845, 'mean_word_length': 3.6006711409395975, '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': '4818254', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1285, 'n_words': 228}