<commit_before>var assert = require('assert')
var _ = require('./_')
var {Cards, Sets} = require('./data')
var BASICS = [
  'Forest',
  'Island',
  'Mountain',
  'Plains',
  'Swamp'
]

function transform(cube, seats, type) {
  var {list, cards, packs} = cube

  assert(typeof list === 'string', 'typeof list')
  assert(typeof cards === 'number', 'typeof cards')
  assert(8 <= cards && cards <= 15, 'cards range')
  assert(typeof packs === 'number', 'typeof packs')
  assert(3 <= packs && packs <= 5, 'packs range')

  list = cube.list.split('\n').map(util.name)

  var bad = []
  for (var cardName of list)
    if (!(cardName in Cards))
      bad.push(cardName)

  if (bad.length) {
    var err = `invalid cards: ${bad.splice(-10).join('; ')}`
    if (bad.length)
      err += `; and ${bad.length} more`
    throw Error(err)
  }

  var min = type === 'cube draft'
    ? seats * cards * packs
    : seats * 90
  assert(min <= list.length && list.length <= 1e3,
    `this cube needs between ${min} and 1000 cards; it has ${list.length}`)

  cube.list = list
}

var util = module.exports = {
  name(s) {
    return s.replace(/[Æâàáéíöúû’]/g, c => {
      switch (c) {
      case 'Æ': return 'AE'
      case 'â': case 'à': case 'á': return 'a'
      case 'é': return 'e'
      case 'í': return 'i'
      case 'ö': return 'o'
      case 'ú': case 'û': return 'u'
      case '’': return "'"
      }
    })
  },
  deck(deck, pool) {
    pool = _.count(pool, 'name')
<commit_msg>tweak<commit_after>var assert = require('assert')
var _ = require('./_')
var {Cards, Sets} = require('./data')
var BASICS = [
  'Forest',
  'Island',
  'Mountain',
  'Plains',
  'Swamp'
]

function transform(cube, seats, type) {
  var {list, cards, packs} = cube

  assert(typeof list === 'string', 'typeof list')
  assert(typeof cards === 'number', 'typeof cards')
  assert(8 <= cards && cards <= 15, 'cards range')
  assert(typeof packs === 'number', 'typeof packs')
  assert(3 <= packs && packs <= 5, 'packs range')

  list = list.split('\n').map(util.name)

  var min = type === 'cube draft'
    ? seats * cards * packs
    : seats * 90
  assert(min <= list.length && list.length <= 1e3,
    `this cube needs between ${min} and 1000 cards; it has ${list.length}`)

  var bad = []
  for (var cardName of list)
    if (!(cardName in Cards))
      bad.push(cardName)

  if (bad.length) {
    var msg = `invalid cards: ${bad.splice(-10).join('; ')}`
    if (bad.length)
      msg += `; and ${bad.length} more`
    throw Error(msg)
  }

  cube.list = list
}

var util = module.exports = {
  name(s) {
    return s.replace(/[Æâàáéíöúû’]/g, c => {
      switch (c) {
      case 'Æ': return 'AE'
      case 'â': case 'à': case 'á': return 'a'
      case 'é': return 'e'
      case 'í': return 'i'
      case 'ö': return 'o'
      case 'ú': case 'û': return 'u'
      case '’': return "'"
      }
    })
  },
  deck(deck, pool) {
    pool = _.count(pool, 'name')

{'fraction_non_alphanumeric': 0.19289860020484806, 'fraction_numerical': 0.010242403550699898, 'mean_word_length': 2.7564102564102564, 'pattern_counts': {'":': 0, '<': 15, '<?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': '5468328', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1057, 'n_words': 308}