<commit_before>
import { _START, _SUCCESS, _FAIL } from '../../constants'
import createReducer from '../../utils/create-reducer'
import { LOAD_ } from '../../constants'
import { DICTIONARY } from './constants'
import { createDataMap } from './helpers'

const initialState = {};

const actionHandlers = {
  [LOAD_ + DICTIONARY + _START]: (state, action) => {
    // console.log('load_dict_start',LOAD_ + DICTIONARY + _START, action);
    return Object.assign({}, state,
      {
        [action.meta.collectionName] : {
          isLoading: true
        }
      }
    )
  },

  [LOAD_ + DICTIONARY + _SUCCESS]: (state, action) => {
    // console.log('load_dict_success', LOAD_ + DICTIONARY + _SUCCESS, action);
    return Object.assign({}, state,
      {
        [action.meta.collectionName] : {
          isLoading: false,
          loaded: true,
          resources: action.resources,
          resourcesMap: createDataMap(action.resources)
        }
      }
    )
  },
  [LOAD_ + DICTIONARY + + _FAIL]: (state, action) => {
    return Object.assign({}, state,
      {
        [action.meta.collectionName] : {
          isLoading: false,
          loaded: false,
          error: action.error
        }
      }
    )
  }

};

export default createReducer(initialState, actionHandlers)<commit_msg>dictionaries empty: fix bug<commit_after>
import { _START, _SUCCESS, _FAIL } from '../../constants'
import createReducer from '../../utils/create-reducer'
import { LOAD_ } from '../../constants'
import { DICTIONARY } from './constants'
import { createDataMap } from './helpers'

const initialState = {};

const actionHandlers = {
  [LOAD_ + DICTIONARY + _START]: (state, action) => {
    // console.log('load_dict_start',LOAD_ + DICTIONARY + _START, action);
    return Object.assign({}, state,
      {
        [action.meta.collectionName] : {
          isLoading: true
        }
      }
    )
  },

  [LOAD_ + DICTIONARY + _SUCCESS]: (state, action) => {
    console.log('load_dict_success', LOAD_ + DICTIONARY + _SUCCESS, action);
    return Object.assign({}, state,
      {
        [action.meta.collectionName] : {
          isLoading: false,
          loaded: true,
          resources: action.payload.data,
          resourcesMap: createDataMap(action.payload.data)
        }
      }
    )
  },
  [LOAD_ + DICTIONARY + + _FAIL]: (state, action) => {
    return Object.assign({}, state,
      {
        [action.meta.collectionName] : {
          isLoading: false,
          loaded: false,
          error: action.error
        }
      }
    )
  }

};

export default createReducer(initialState, actionHandlers)
{'fraction_non_alphanumeric': 0.1436231328992723, 'fraction_numerical': 0.0, 'mean_word_length': 2.3358876117496807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '506335', 'n_tokens_mistral': 789, 'n_tokens_neox': 795, 'n_words': 168}