<commit_before>define 'cs!xlform/view.row', [
        'backbone',
        'jquery',
        'cs!xlform/view.rowSelector',
        'cs!xlform/model.row',
        'cs!xlform/view.templates',
        'cs!xlform/view.utils',
        'cs!xlform/view.choices',
        'cs!xlform/view.rowDetail',
        ], (
            Backbone,
            $,
            $rowSelector,
            $row,
            $viewTemplates,
            $viewUtils,
            $viewChoices,
            $viewRowDetail,
            )->
  class BaseRowView extends Backbone.View
    tagName: "li"
    className: "survey__row  xlf-row-view xlf-row-view--depr"
    events:
     "drop": "drop"

    initialize: (opts)->
      @options = opts
      typeDetail = @model.get("type")
      @$el.attr("data-row-id", @model.cid)
      @ngScope = opts.ngScope
      @surveyView = @options.surveyView
      @model.on "detail-change", (key, value, ctxt)=>
        customEventName = "row-detail-change-#{key}"
        @$(".on-#{customEventName}").trigger(customEventName, key, value, ctxt)

    drop: (evt, index)->
      @$el.trigger("update-sort", [@model, index])

    getApp: ->
      @surveyView.getApp()

    # expandRowSelector: ->
    #   new $rowSelector.RowSelector(el: @$el.find(".survey__row__spacer").get(0), ngScope: @ngScope, spawnedFromView: @).expand()

    render: ->
      if @already_rendered
        return

      @already_rendered = true

      if @model instanceof $row.RowError
        @_renderError()
      else
        @_renderRow()
      @is_expanded = @$card?.hasClass('card--expandedchoices')
      @
    _renderError: ->
      @$el.addClass("xlf-row-view-error")
      atts = $viewUtils.cleanStringify(@model.toJSON())
      @$el.html $viewTemplates.$$render('row.rowErrorView', atts)
      @
    _renderRow: ->
      @$el.html $viewTemplates.$$render('row.xlfRowView', @surveyView)
      @$label = @$('.card__header-title')
      @$card = @$('.card')
      @$header = @$('.card__header')
      context = {warnings: []}
      if 'getList' of @model and (cl = @model.getList())
        @$card.addClass('card--selectquestion card--expandedchoices')
        @is_expanded = true

        @listView = new $viewChoices.ListView(model: cl, rowView: @).render()

      @cardSettingsWrap = @$('.card__settings').eq(0)
      @defaultRowDetailParent = @cardSettingsWrap.find('.card__settings__fields--question-options').eq(0)
      for [key, val] in @model.attributesArray() when key is 'label' or key is 'type'
        view = new $viewRowDetail.DetailView(model: val, rowView: @)
        if key == 'label' and @model.get('type').get('value') == 'calculate'
          view.model = @model.get('calculation')
          @model.finalize()
          val.set('value', '')
        view.render().insertInDOM(@)
        if key == 'label'
          @make_label_editable(view)

      @

    toggleSettings: (show)->
      if show is undefined
        show = !@_settingsExpanded

      if show and !@_settingsExpanded
        @_expandedRender()
        @$card.addClass('card--expanded-settings')
        @hideMultioptions?()
        @_settingsExpanded = true
      else if !show and @_settingsExpanded
        @$card.removeClass('card--expanded-settings')
        @_cleanupExpandedRender()
        @_settingsExpanded = false
      ``

    _cleanupExpandedRender: ->
      @$('.card__settings').detach()

    clone: (event) =>
      model = @model
      if @model.get('type').get('typeId') in ['select_one', 'select_multiple']
        model = @model.clone()

      @model.getSurvey().insert_row.call model._parent._parent, model, model._parent.models.indexOf(@model) + 1

    add_row_to_question_library: (evt) =>
      evt.stopPropagation()
      @ngScope?.add_row_to_question_library @model

  class GroupView extends BaseRowView
    className: "survey__row survey__row--group  xlf-row-view xlf-row-view--depr"
    initialize: (opts)->
      @options = opts
      @_shrunk = !!opts.shrunk
      @$el.attr("data-row-id", @model.cid)
      @surveyView = @options.surveyView

    deleteGroup: (evt)=>
      skipConfirm = $(evt.currentTarget).hasClass('js-force-delete-group')
      if skipConfirm or confirm('Are you sure you want to split apart this group?')
        @_deleteGroup()
      evt.preventDefault()

    _deleteGroup: () =>
      @model.splitApart()
      @model._parent._parent.trigger('remove', @model)
      @$el.detach()

    render: ->
      if !@already_rendered
        @$el.html $viewTemplates.row.groupView(@model)
        @$label = @$('.group__label').eq(0)
        @$rows = @$('.group__rows').eq(0)
        @$card = @$('.card')
        @$header = @$('.card__header,.group__header').eq(0)

      @model.rows.each (row)=>
        @getApp().ensureElInView(row, @, @$rows).render()

      if !@already_rendered
        # only render the row details which are necessary for the initial view (ie 'label')
        @make_label_editable new $viewRowDetail.DetailView(model: @model.get('label'), rowView: @).render().insertInDOM(@)



      @already_rendered = true
      @

    hasNestedGroups: ->
      _.filter(@model.rows.models, (row) -> row.constructor.key == 'group').length > 0
    _expandedRender: ->
      @$header.after($viewTemplates.row.groupSettingsView())
      @cardSettingsWrap = @$('.card__settings').eq(0)
      @defaultRowDetailParent = @cardSettingsWrap.find('.card__settings__fields--active').eq(0)
      for [key, val] in @model.attributesArray() when key in ["name", "_isRepeat", "appearance", "relevant"]
        new $viewRowDetail.DetailView(model: val, rowView: @).render().insertInDOM(@)

      if @hasNestedGroups()
        @$('.xlf-dv-appearance').hide()

      @model.on 'add', (row) =>
        if row.constructor.key == 'group'
          $appearanceField = @$('.xlf-dv-appearance').eq(0)
          $appearanceField.hide()
          $appearanceField.find('input:checkbox').prop('checked', false)
          appearanceModel = @model.get('appearance')
          if appearanceModel.getValue()
            @surveyView.ngScope.miscUtils.alert("You can't display nested groups on the same screen - the setting has been removed from the parent group")
          appearanceModel.set('value', '')

      @model.on 'remove', (row) =>
        if row.constructor.key == 'group' && !@hasNestedGroups()
          @$('.xlf-dv-appearance').eq(0).show()
      @
    make_label_editable: (view) ->
      $viewUtils.makeEditable view, view.model, @$label, options:
        placement: 'right'
        rows: 3
      ,
      edit_callback: (value) ->
        value = value.replace(new RegExp(String.fromCharCode(160), 'g'), '')
        value = value.replace /\t/g, ' '
        view.model.set 'value', value

        if value == ''
          return newValue: new Array(10).join('&nbsp;')
        else
        return newValue: value;

  class RowView extends BaseRowView
    _expandedRender: ->
      @$header.after($viewTemplates.row.rowSettingsView())
      @cardSettingsWrap = @$('.card__settings').eq(0)
      @defaultRowDetailParent = @cardSettingsWrap.find('.card__settings__fields--question-options').eq(0)

      for [key, val] in @model.attributesArray() when key isnt "label" and key isnt "type"
        new $viewRowDetail.DetailView(model: val, rowView: @).render().insertInDOM(@)
      @

    hideMultioptions: ->
      @$card.removeClass('card--expandedchoices')
      @is_expanded = false
    showMultioptions: ->
      @$card.addClass('card--expandedchoices')
      @$card.removeClass('card--expanded-settings')
      @toggleSettings(false)

    toggleMultioptions: ->
      if @is_expanded
        @hideMultioptions()
      else
        @showMultioptions()
        @is_expanded = true
      return
    make_label_editable: (view) ->
      $viewUtils.makeEditable view, view.model, @$label, options:
        placement: 'right'
        rows: 3
      ,
      transformFunction: (value) -> value

  class RankScoreView extends RowView
    _expandedRender: ->
      super()
      @$("li[data-card-settings-tab-id='validation-criteria']").hide()

  class ScoreView extends RankScoreView
    className: "survey__row survey__row--score"
    _renderRow: (args...)->
      super(args)
      beta_elem = $('<p>', {
              class: 'scorerank-beta-warning'
              text: 'Note: Rank and Score question types are currently in beta.'
              })
      while @model._scoreChoices.options.length < 2
        @model._scoreChoices.options.add(label: 'Option')
      score_choices = for sc in @model._scoreChoices.options.models
        label: sc.get('label')
        name: sc.get('name')
        cid: sc.cid
      if @model._scoreRows.length < 1
        @model._scoreRows.add
          label: 'Enter your question'
          name: ''

      score_rows = for sr in @model._scoreRows.models
        label: sr.get('label')
        name: sr.get('name')
        cid: sr.cid

      template_args = {
        score_rows: score_rows
        score_choices: score_choices
      }

      extra_score_contents = $viewTemplates.$$render('row.scoreView', template_args)
      @$('.card--selectquestion__expansion').eq(0).append(extra_score_contents)
      $rows = @$('.score__contents--rows').eq(0)
      $choices = @$('.score__contents--choices').eq(0)

      $el = @$el
      offOn = (evtName, selector, callback)->
        $el.off(evtName).on(evtName, selector, callback)

      get_row = (cid)=> @model._scoreRows.get(cid)
      get_choice = (cid)=> @model._scoreChoices.options.get(cid)
      offOn 'click.deletescorerow', '.js-delete-scorerow', (evt)=>
        $et = $(evt.target)
        row_cid = $et.closest('tr').eq(0).data('row-cid')
        @model._scoreRows.remove(get_row(row_cid))
        @already_rendered = false
        @render()
      offOn 'click.deletescorecol', '.js-delete-scorecol', (evt)=>
        log 'here'
        $et = $(evt.target)
        @model._scoreChoices.options.remove(get_choice($et.closest('th').data('cid')))
        @already_rendered = false
        @render()

      offOn 'input.editscorelabel', '.scorelabel__edit', (evt)->
        $et = $(evt.target)
        row_cid = $et.closest('tr').eq(0).data('row-cid')
        get_row(row_cid).set('label', $et.text())

      offOn 'input.namechange', '.scorelabel__name', (evt)=>
        $et = $(evt.target)
        row_cid = $et.closest('tr').eq(0).data('row-cid')
        get_row(row_cid).set('name', $et.text())

      offOn 'input.choicechange', '.scorecell__label', (evt)=>
        $et = $(evt.target)
        get_choice($et.closest('th').data('cid')).set('label', $et.text())

      offOn 'input.optvalchance', '.scorecell__name', (evt)=>
        $et = $(evt.target)
        get_choice($et.closest('th').eq(0).data('cid')).set('name', $et.text())

      offOn 'blur.choicechange', '.scorecell__label', (evt)=>
        @render()

      offOn 'click.addchoice', '.scorecell--add', (evt)=>
        @already_rendered = false
        @model._scoreChoices.options.add([label: 'Option'])
        @render()

      offOn 'click.addrow', '.scorerow--add', (evt)=>
        @already_rendered = false
        @model._scoreRows.add([label: 'Enter your question'])
        @render()

  class RankView extends RankScoreView
    className: "survey__row survey__row--score"
    _renderRow: (args...)->
      super(args)
      beta_elem = $('<p>', {
                    class: 'scorerank-beta-warning'
                    text: 'Note: Rank and Score question types are currently in beta.'
                    })
      @$el.append(beta_elem)
      template_args = {}
      template_args.rank_constraint_msg = @model.get('kobo--rank-constraint-message')?.get('value')

      while @model._rankLevels.options.length < 2
        @model._rankLevels.options.add
          label: "Item to be ranked"
          name: ''

      rank_levels = for model in @model._rankLevels.options.models
        label: model.get('label')
        name: model.get('name')
        cid: model.cid
      template_args.rank_levels = rank_levels

      while @model._rankRows.length < 1
        @model._rankRows.add
          label: '1st choice'
          name: ''
      rank_rows = for model in @model._rankRows.models
        label: model.get('label')
        name: model.get('name')
        cid: model.cid
      template_args.rank_rows = rank_rows
      extra_score_contents = $viewTemplates.$$render('row.rankView', @, template_args)
      @$('.card--selectquestion__expansion').eq(0).append(extra_score_contents)
      @editRanks()
    editRanks: ->
      @$([
          '.rank_items__item__label',
          '.rank_items__level__label',
          '.rank_items__constraint_message',
          '.rank_items__name',
        ].join(',')).attr('contenteditable', 'true')
      $el = @$el<commit_msg>beta message appears on rank and score questions<commit_after>define 'cs!xlform/view.row', [
        'backbone',
        'jquery',
        'cs!xlform/view.rowSelector',
        'cs!xlform/model.row',
        'cs!xlform/view.templates',
        'cs!xlform/view.utils',
        'cs!xlform/view.choices',
        'cs!xlform/view.rowDetail',
        ], (
            Backbone,
            $,
            $rowSelector,
            $row,
            $viewTemplates,
            $viewUtils,
            $viewChoices,
            $viewRowDetail,
            )->
  class BaseRowView extends Backbone.View
    tagName: "li"
    className: "survey__row  xlf-row-view xlf-row-view--depr"
    events:
     "drop": "drop"

    initialize: (opts)->
      @options = opts
      typeDetail = @model.get("type")
      @$el.attr("data-row-id", @model.cid)
      @ngScope = opts.ngScope
      @surveyView = @options.surveyView
      @model.on "detail-change", (key, value, ctxt)=>
        customEventName = "row-detail-change-#{key}"
        @$(".on-#{customEventName}").trigger(customEventName, key, value, ctxt)

    drop: (evt, index)->
      @$el.trigger("update-sort", [@model, index])

    getApp: ->
      @surveyView.getApp()

    # expandRowSelector: ->
    #   new $rowSelector.RowSelector(el: @$el.find(".survey__row__spacer").get(0), ngScope: @ngScope, spawnedFromView: @).expand()

    render: ->
      if @already_rendered
        return

      @already_rendered = true

      if @model instanceof $row.RowError
        @_renderError()
      else
        @_renderRow()
      @is_expanded = @$card?.hasClass('card--expandedchoices')
      @
    _renderError: ->
      @$el.addClass("xlf-row-view-error")
      atts = $viewUtils.cleanStringify(@model.toJSON())
      @$el.html $viewTemplates.$$render('row.rowErrorView', atts)
      @
    _renderRow: ->
      @$el.html $viewTemplates.$$render('row.xlfRowView', @surveyView)
      @$label = @$('.card__header-title')
      @$card = @$('.card')
      @$header = @$('.card__header')
      context = {warnings: []}
      if 'getList' of @model and (cl = @model.getList())
        @$card.addClass('card--selectquestion card--expandedchoices')
        @is_expanded = true

        @listView = new $viewChoices.ListView(model: cl, rowView: @).render()

      @cardSettingsWrap = @$('.card__settings').eq(0)
      @defaultRowDetailParent = @cardSettingsWrap.find('.card__settings__fields--question-options').eq(0)
      for [key, val] in @model.attributesArray() when key is 'label' or key is 'type'
        view = new $viewRowDetail.DetailView(model: val, rowView: @)
        if key == 'label' and @model.get('type').get('value') == 'calculate'
          view.model = @model.get('calculation')
          @model.finalize()
          val.set('value', '')
        view.render().insertInDOM(@)
        if key == 'label'
          @make_label_editable(view)

      @

    toggleSettings: (show)->
      if show is undefined
        show = !@_settingsExpanded

      if show and !@_settingsExpanded
        @_expandedRender()
        @$card.addClass('card--expanded-settings')
        @hideMultioptions?()
        @_settingsExpanded = true
      else if !show and @_settingsExpanded
        @$card.removeClass('card--expanded-settings')
        @_cleanupExpandedRender()
        @_settingsExpanded = false
      ``

    _cleanupExpandedRender: ->
      @$('.card__settings').detach()

    clone: (event) =>
      model = @model
      if @model.get('type').get('typeId') in ['select_one', 'select_multiple']
        model = @model.clone()

      @model.getSurvey().insert_row.call model._parent._parent, model, model._parent.models.indexOf(@model) + 1

    add_row_to_question_library: (evt) =>
      evt.stopPropagation()
      @ngScope?.add_row_to_question_library @model

  class GroupView extends BaseRowView
    className: "survey__row survey__row--group  xlf-row-view xlf-row-view--depr"
    initialize: (opts)->
      @options = opts
      @_shrunk = !!opts.shrunk
      @$el.attr("data-row-id", @model.cid)
      @surveyView = @options.surveyView

    deleteGroup: (evt)=>
      skipConfirm = $(evt.currentTarget).hasClass('js-force-delete-group')
      if skipConfirm or confirm('Are you sure you want to split apart this group?')
        @_deleteGroup()
      evt.preventDefault()

    _deleteGroup: () =>
      @model.splitApart()
      @model._parent._parent.trigger('remove', @model)
      @$el.detach()

    render: ->
      if !@already_rendered
        @$el.html $viewTemplates.row.groupView(@model)
        @$label = @$('.group__label').eq(0)
        @$rows = @$('.group__rows').eq(0)
        @$card = @$('.card')
        @$header = @$('.card__header,.group__header').eq(0)

      @model.rows.each (row)=>
        @getApp().ensureElInView(row, @, @$rows).render()

      if !@already_rendered
        # only render the row details which are necessary for the initial view (ie 'label')
        @make_label_editable new $viewRowDetail.DetailView(model: @model.get('label'), rowView: @).render().insertInDOM(@)



      @already_rendered = true
      @

    hasNestedGroups: ->
      _.filter(@model.rows.models, (row) -> row.constructor.key == 'group').length > 0
    _expandedRender: ->
      @$header.after($viewTemplates.row.groupSettingsView())
      @cardSettingsWrap = @$('.card__settings').eq(0)
      @defaultRowDetailParent = @cardSettingsWrap.find('.card__settings__fields--active').eq(0)
      for [key, val] in @model.attributesArray() when key in ["name", "_isRepeat", "appearance", "relevant"]
        new $viewRowDetail.DetailView(model: val, rowView: @).render().insertInDOM(@)

      if @hasNestedGroups()
        @$('.xlf-dv-appearance').hide()

      @model.on 'add', (row) =>
        if row.constructor.key == 'group'
          $appearanceField = @$('.xlf-dv-appearance').eq(0)
          $appearanceField.hide()
          $appearanceField.find('input:checkbox').prop('checked', false)
          appearanceModel = @model.get('appearance')
          if appearanceModel.getValue()
            @surveyView.ngScope.miscUtils.alert("You can't display nested groups on the same screen - the setting has been removed from the parent group")
          appearanceModel.set('value', '')

      @model.on 'remove', (row) =>
        if row.constructor.key == 'group' && !@hasNestedGroups()
          @$('.xlf-dv-appearance').eq(0).show()
      @
    make_label_editable: (view) ->
      $viewUtils.makeEditable view, view.model, @$label, options:
        placement: 'right'
        rows: 3
      ,
      edit_callback: (value) ->
        value = value.replace(new RegExp(String.fromCharCode(160), 'g'), '')
        value = value.replace /\t/g, ' '
        view.model.set 'value', value

        if value == ''
          return newValue: new Array(10).join('&nbsp;')
        else
        return newValue: value;

  class RowView extends BaseRowView
    _expandedRender: ->
      @$header.after($viewTemplates.row.rowSettingsView())
      @cardSettingsWrap = @$('.card__settings').eq(0)
      @defaultRowDetailParent = @cardSettingsWrap.find('.card__settings__fields--question-options').eq(0)

      for [key, val] in @model.attributesArray() when key isnt "label" and key isnt "type"
        new $viewRowDetail.DetailView(model: val, rowView: @).render().insertInDOM(@)
      @

    hideMultioptions: ->
      @$card.removeClass('card--expandedchoices')
      @is_expanded = false
    showMultioptions: ->
      @$card.addClass('card--expandedchoices')
      @$card.removeClass('card--expanded-settings')
      @toggleSettings(false)

    toggleMultioptions: ->
      if @is_expanded
        @hideMultioptions()
      else
        @showMultioptions()
        @is_expanded = true
      return
    make_label_editable: (view) ->
      $viewUtils.makeEditable view, view.model, @$label, options:
        placement: 'right'
        rows: 3
      ,
      transformFunction: (value) -> value

  class RankScoreView extends RowView
    _expandedRender: ->
      super()
      @$("li[data-card-settings-tab-id='validation-criteria']").hide()

  class ScoreView extends RankScoreView
    className: "survey__row survey__row--score"
    _renderRow: (args...)->
      super(args)
      beta_elem = $('<p>', {
              class: 'scorerank-beta-warning'
              text: 'Note: Rank and Score question types are currently in beta.'
              })
      while @model._scoreChoices.options.length < 2
        @model._scoreChoices.options.add(label: 'Option')
      score_choices = for sc in @model._scoreChoices.options.models
        label: sc.get('label')
        name: sc.get('name')
        cid: sc.cid
      if @model._scoreRows.length < 1
        @model._scoreRows.add
          label: 'Enter your question'
          name: ''

      score_rows = for sr in @model._scoreRows.models
        label: sr.get('label')
        name: sr.get('name')
        cid: sr.cid

      template_args = {
        score_rows: score_rows
        score_choices: score_choices
      }

      extra_score_contents = $viewTemplates.$$render('row.scoreView', template_args)
      @$('.card--selectquestion__expansion').eq(0).append(extra_score_contents)
      @$('.card').eq(0).append(beta_elem)
      $rows = @$('.score__contents--rows').eq(0)
      $choices = @$('.score__contents--choices').eq(0)

      $el = @$el
      offOn = (evtName, selector, callback)->
        $el.off(evtName).on(evtName, selector, callback)

      get_row = (cid)=> @model._scoreRows.get(cid)
      get_choice = (cid)=> @model._scoreChoices.options.get(cid)
      offOn 'click.deletescorerow', '.js-delete-scorerow', (evt)=>
        $et = $(evt.target)
        row_cid = $et.closest('tr').eq(0).data('row-cid')
        @model._scoreRows.remove(get_row(row_cid))
        @already_rendered = false
        @render()
      offOn 'click.deletescorecol', '.js-delete-scorecol', (evt)=>
        log 'here'
        $et = $(evt.target)
        @model._scoreChoices.options.remove(get_choice($et.closest('th').data('cid')))
        @already_rendered = false
        @render()

      offOn 'input.editscorelabel', '.scorelabel__edit', (evt)->
        $et = $(evt.target)
        row_cid = $et.closest('tr').eq(0).data('row-cid')
        get_row(row_cid).set('label', $et.text())

      offOn 'input.namechange', '.scorelabel__name', (evt)=>
        $et = $(evt.target)
        row_cid = $et.closest('tr').eq(0).data('row-cid')
        get_row(row_cid).set('name', $et.text())

      offOn 'input.choicechange', '.scorecell__label', (evt)=>
        $et = $(evt.target)
        get_choice($et.closest('th').data('cid')).set('label', $et.text())

      offOn 'input.optvalchance', '.scorecell__name', (evt)=>
        $et = $(evt.target)
        get_choice($et.closest('th').eq(0).data('cid')).set('name', $et.text())

      offOn 'blur.choicechange', '.scorecell__label', (evt)=>
        @render()

      offOn 'click.addchoice', '.scorecell--add', (evt)=>
        @already_rendered = false
        @model._scoreChoices.options.add([label: 'Option'])
        @render()

      offOn 'click.addrow', '.scorerow--add', (evt)=>
        @already_rendered = false
        @model._scoreRows.add([label: 'Enter your question'])
        @render()

  class RankView extends RankScoreView
    className: "survey__row survey__row--score"
    _renderRow: (args...)->
      super(args)
      beta_elem = $('<p>', {
                    class: 'scorerank-beta-warning'
                    text: 'Note: Rank and Score question types are currently in beta.'
                    })
      template_args = {}
      template_args.rank_constraint_msg = @model.get('kobo--rank-constraint-message')?.get('value')

      while @model._rankLevels.options.length < 2
        @model._rankLevels.options.add
          label: "Item to be ranked"
          name: ''

      rank_levels = for model in @model._rankLevels.options.models
        label: model.get('label')
        name: model.get('name')
        cid: model.cid
      template_args.rank_levels = rank_levels

      while @model._rankRows.length < 1
        @model._rankRows.add
          label: '1st choice'
          name: ''
      rank_rows = for model in @model._rankRows.models
        label: model.get('label')
        name: model.get('name')
        cid: model.cid
      template_args.rank_rows = rank_rows
      extra_score_contents = $viewTemplates.$$render('row.rankView', @, template_args)
      @$('.card').append(beta_elem)
      @$('.card--selectquestion__expansion').eq(0).append(extra_score_contents)
      @editRanks()
    editRanks: ->
      @$([
          '.rank_items__item__label',
          '.rank_items__level__label',
          '.rank_items__constraint_message',
          '.rank_items__name',
        ].join(',')).attr('contenteditable', 'true')
      $el = @$el
{'fraction_non_alphanumeric': 0.15817925415230336, 'fraction_numerical': 0.002702914446881855, 'mean_word_length': 2.5800028046557286, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 103, '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': '2543214', 'n_tokens_mistral': 8224, 'n_tokens_neox': 8087, 'n_words': 1455}