<commit_before>const FEHierarchy = require('noframenet-core').FEHierarchy;
const FrameHierarchy = require('noframenet-core').FrameHierarchy;
const FRTYPE_NAMES_FOR_FRAME_HIERARCHY = require('../../utils/constants').FRTYPE_NAMES_FOR_FRAME_HIERARCHY;
const FRTYPE_NAMES_FOR_FE_HIERARCHY = require('../../utils/constants').FRTYPE_NAMES_FOR_FE_HIERARCHY;
const config = require('./../../config');

const logger = config.logger;

function getRelatives(itemName, childrenParentsMap, type, visitedSet) {
  if (!childrenParentsMap.has(itemName)) {
    return [];
  }
  return Array.from(childrenParentsMap.get(itemName)).reduce((array, item) => {
    if (!visitedSet.has(item)) {
      visitedSet.add(item);
      array.push({
        name: item,
        [type]: getRelatives(item, childrenParentsMap, type, visitedSet),
      });
    }
    return array;
  }, []);
}

function fillFEhierarchyMap(feHierarchyMap, fesMap, parentsMap, childrenMap) {
  fesMap.forEach((fe, feID) => {
    if (!feHierarchyMap.has(fe.name)) {
      const visitedSet = new Set([fe.name]);
      feHierarchyMap.set(fe.name, new FEHierarchy({
        name: fe.name,
        parents: getRelatives(fe.name, parentsMap, 'parents', visitedSet),
        children: getRelatives(fe.name, childrenMap, 'children', visitedSet),
      }));
    }
  });
  return feHierarchyMap;
}

function fillFrameHierarchyMap(frameHierarchyMap, framesMap, parentsMap,
                               childrenMap) {
  framesMap.forEach((frame, frameID) => {
    if (!frameHierarchyMap.has(frame.name)) {
      const visitedSet = new Set([frame.name]);
      frameHierarchyMap.set(frame.name, new FrameHierarchy({
        name: frame.name,
        parents: getRelatives(frame.name, parentsMap, 'parents', visitedSet),
        children: getRelatives(frame.name, childrenMap, 'children', visitedSet),
      }));
    }<commit_msg>Removed unused vars<commit_after>const FEHierarchy = require('noframenet-core').FEHierarchy;
const FrameHierarchy = require('noframenet-core').FrameHierarchy;
const FRTYPE_NAMES_FOR_FRAME_HIERARCHY = require('../../utils/constants').FRTYPE_NAMES_FOR_FRAME_HIERARCHY;
const FRTYPE_NAMES_FOR_FE_HIERARCHY = require('../../utils/constants').FRTYPE_NAMES_FOR_FE_HIERARCHY;
const config = require('./../../config');

const logger = config.logger;

function getRelatives(itemName, childrenParentsMap, type, visitedSet) {
  if (!childrenParentsMap.has(itemName)) {
    return [];
  }
  return Array.from(childrenParentsMap.get(itemName)).reduce((array, item) => {
    if (!visitedSet.has(item)) {
      visitedSet.add(item);
      array.push({
        name: item,
        [type]: getRelatives(item, childrenParentsMap, type, visitedSet),
      });
    }
    return array;
  }, []);
}

function fillFEhierarchyMap(feHierarchyMap, fesMap, parentsMap, childrenMap) {
  fesMap.forEach((fe) => {
    if (!feHierarchyMap.has(fe.name)) {
      const visitedSet = new Set([fe.name]);
      feHierarchyMap.set(fe.name, new FEHierarchy({
        name: fe.name,
        parents: getRelatives(fe.name, parentsMap, 'parents', visitedSet),
        children: getRelatives(fe.name, childrenMap, 'children', visitedSet),
      }));
    }
  });
  return feHierarchyMap;
}

function fillFrameHierarchyMap(frameHierarchyMap, framesMap, parentsMap,
                               childrenMap) {
  framesMap.forEach((frame) => {
    if (!frameHierarchyMap.has(frame.name)) {
      const visitedSet = new Set([frame.name]);
      frameHierarchyMap.set(frame.name, new FrameHierarchy({
        name: frame.name,
        parents: getRelatives(frame.name, parentsMap, 'parents', visitedSet),
        children: getRelatives(frame.name, childrenMap, 'children', visitedSet),
      }));
    }
{'fraction_non_alphanumeric': 0.14082235958075787, 'fraction_numerical': 0.0, 'mean_word_length': 3.7902187902187903, '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': '2743156', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1208, 'n_words': 200}