<commit_before>/*
 * A helper function to convert a tree into text..
 */
define(['../tree'], function(Tree) {
  return function stringify( item ) {
    switch( true ) {
      case item instanceof Tree.Assignment:
        return item.name + ' := ' + htmlify(item.relation)
      
      case item instanceof Tree.Relation:
        return '[[\'' + item.relation.header.join('\', \'') + '\'] -> [' + item.relation.data.map(function(row) { return row.join(', ')}).join('], [') + ']]'
      
      case item instanceof Tree.RelationReference:
        return item.name
      
      case item instanceof Tree.Projection:
        return 'Project[' + stringify( item.projectionList) + ']( ' + stringify( item.relation ) + ' )'
      
      case item instanceof Tree.Rename:
        return 'Rename[' + item.from + '/' + item.to + ']( ' + stringify( item.relation ) + ' )'

      case item instanceof Tree.Selection:
        return 'Select[' + stringify( item.criteria) + ']( ' + stringify( item.relation ) + ' )'
      
      case item instanceof Tree.ProjectionList:
         return item.list.join(', ')
    
      case item instanceof Tree.Union:
        return stringify( item.left ) + ' Union ' + stringify( item.right )

      case item instanceof Tree.Intersection:
        return stringify( item.left ) + ' Intersect ' + stringify( item.right )

      case item instanceof Tree.Difference:
        return stringify( item.left ) + ' − ' + stringify( item.right )

      case item instanceof Tree.Cartesian:
        return stringify( item.left ) + ' X ' + stringify( item.right )<commit_msg>Fixed bug where stringify would fail, because of naive copy/paste from htmlify.<commit_after>/*
 * A helper function to convert a tree into text..
 */
define(['../tree'], function(Tree) {
  return function stringify( item ) {
    switch( true ) {
      case item instanceof Tree.Assignment:
        return item.name + ' := ' + stringify(item.relation)
      
      case item instanceof Tree.Relation:
        return '[[\'' + item.relation.header.join('\', \'') + '\'] -> [' + item.relation.data.map(function(row) { return row.join(', ')}).join('], [') + ']]'
      
      case item instanceof Tree.RelationReference:
        return item.name
      
      case item instanceof Tree.Projection:
        return 'Project[' + stringify( item.projectionList) + ']( ' + stringify( item.relation ) + ' )'
      
      case item instanceof Tree.Rename:
        return 'Rename[' + item.from + '/' + item.to + ']( ' + stringify( item.relation ) + ' )'

      case item instanceof Tree.Selection:
        return 'Select[' + stringify( item.criteria) + ']( ' + stringify( item.relation ) + ' )'
      
      case item instanceof Tree.ProjectionList:
         return item.list.join(', ')
    
      case item instanceof Tree.Union:
        return stringify( item.left ) + ' Union ' + stringify( item.right )

      case item instanceof Tree.Intersection:
        return stringify( item.left ) + ' Intersect ' + stringify( item.right )

      case item instanceof Tree.Difference:
        return stringify( item.left ) + ' − ' + stringify( item.right )

      case item instanceof Tree.Cartesian:
        return stringify( item.left ) + ' X ' + stringify( item.right )
{'fraction_non_alphanumeric': 0.1429894996911674, 'fraction_numerical': 0.0, 'mean_word_length': 2.513015184381779, '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': '7193282', 'n_tokens_mistral': 925, 'n_tokens_neox': 920, 'n_words': 245}