<commit_before>function getDictionary(firebase, cback, localStorage) {
  var calibrationMatrices = firebase.child("calibrationMatrices");
  calibrationMatrices.on("value", function(snapshot) {
    var value = snapshot.val();
    var dictionary = Object.keys(value);
    console.log('displaying current dictionary');
    cback(dictionary);
    localStorage.setItem("dictionary", dictionary);
  }, function(err) {
       console.log(err);
     });
}

function displayDictionary(dictionary) {
  var ID = "dictionary";
  var dictElem = document.getElementById(ID);
  var html = "";
  for (var wordInd in dictionary) {
    html += (parseInt(wordInd) + 1) + ". " + dictionary[wordInd] + "<br>";
  }
  dictElem.innerHTML = html;
}

function displayOldDict() {
  var oldDict = localStorage.dictionary.split(",");
  if (oldDict) {
    displayDictionary(oldDict);
    console.log("displaying old dictionary from localStorage temporarily");
  }
}
function doOnLoad() {
  displayOldDict();
  var dictionary = getDictionary(firebase, displayDictionary, localStorage);
}<commit_msg>Fixed bug trying to split nonexistent value from localStorage<commit_after>function getDictionary(firebase, cback, localStorage) {
  var calibrationMatrices = firebase.child("calibrationMatrices");
  calibrationMatrices.on("value", function(snapshot) {
    var value = snapshot.val();
    var dictionary = Object.keys(value);
    console.log('displaying current dictionary');
    cback(dictionary);
    localStorage.setItem("dictionary", dictionary);
  }, function(err) {
       console.log(err);
     });
}

function displayDictionary(dictionary) {
  var ID = "dictionary";
  var dictElem = document.getElementById(ID);
  var html = "";
  for (var wordInd in dictionary) {
    html += (parseInt(wordInd) + 1) + ". " + dictionary[wordInd] + "<br>";
  }
  dictElem.innerHTML = html;
}

function displayOldDict() {
  var oldDictStr = localStorage.dictionary;
  if (oldDictStr) {
    var oldDict = oldDictStr.split(",");
    if (oldDict) {
      displayDictionary(oldDict);
      console.log("displaying old dictionary from localStorage temporarily");
    }
  }
}

function doOnLoad() {
  displayOldDict();
  var dictionary = getDictionary(firebase, displayDictionary, localStorage);
}
{'fraction_non_alphanumeric': 0.13155555555555556, 'fraction_numerical': 0.0008888888888888889, 'mean_word_length': 4.544334975369458, 'pattern_counts': {'":': 0, '<': 5, '<?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': '181652', 'n_tokens_mistral': 654, 'n_tokens_neox': 643, 'n_words': 147}