function parseRecords(data) {
  const result = [];

  const intentStr = Object.keys(data)[0];
  const entries = data[intentStr];
  entries.forEach(entry => {
    const clauses = entry.data;
    const tagArray = [];
    for (const clause of clauses) {
      // Each clause has multiple tokens. They will all share the same tag.
      const tokens = tokenizeSentence(clause.text);
      const entity = clause.entity;
      let tag;
      if (entity == null) {
        tag = TAGS[0];
      } else {
        tag = entityToTag[entity] ? entityToTag[entity] : TAGS[0];
      }

      for (const token of tokens) {
        tagArray.push({token, tag});
      }
    }
    result.push([tagArray, intentStr]);
  });

  return result;
}
These are the mappings of 'entities' in the source data to the tags
we want to use in our classifier.