<commit_before>﻿using System;
using System.Collections.Generic;

namespace Delta
{
    internal class EntityHelper
    {
        internal static Dictionary<string, IEntity> _idReferences = new Dictionary<string, IEntity>();

        internal static void AddIDReference(IEntity entity)
        {
            if (string.IsNullOrEmpty(entity.Name.ToLower())) //if the ID is null, make it a unique.
                entity.Name = Guid.NewGuid().ToString();
            if (EntityHelper._idReferences.ContainsKey(entity.Name.ToLower())) //if the ID already exists, append a numerical increment
            {
                for (int x = 1; x < int.MaxValue; x++)
                {
                    string newID = entity.Name + x;
                    if (!EntityHelper._idReferences.ContainsKey(newID))
                    {
                        entity.Name = newID;
                        break;
                    }
                }
            }
            EntityHelper._idReferences.Add(entity.Name.ToLower(), entity);
        }

        internal static void RemoveIDReference(IEntity entity)
        {
            if (EntityHelper._idReferences.ContainsKey(entity.Name.ToLower()))
                EntityHelper._idReferences.Remove(entity.Name);<commit_msg>Another entity ID reference fix..<commit_after>﻿using System;
using System.Collections.Generic;

namespace Delta
{
    internal class EntityHelper
    {
        internal static Dictionary<string, IEntity> _idReferences = new Dictionary<string, IEntity>();

        internal static void AddIDReference(IEntity entity)
        {
            string id = entity.Name.ToLower();
            if (string.IsNullOrEmpty(id)) //if the ID is null, make it a unique.
                id = Guid.NewGuid().ToString().ToLower();
            if (_idReferences.ContainsKey(id)) //if the ID already exists, append a numerical increment
            {
                for (int x = 1; x < int.MaxValue; x++)
                {
                    string newID = id + x;
                    if (!_idReferences.ContainsKey(newID))
                    {
                        id = newID;
                        break;
                    }
                }
            }
            entity.Name = id;
            _idReferences.Add(id, entity);
        }

        internal static void RemoveIDReference(IEntity entity)
        {
            string id = entity.Name.ToLower();
            if (EntityHelper._idReferences.ContainsKey(id))
                EntityHelper._idReferences.Remove(id);
{'fraction_non_alphanumeric': 0.09205847491110233, 'fraction_numerical': 0.0007902015013828526, 'mean_word_length': 1.6184074457083764, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '4919803', 'n_tokens_mistral': 641, 'n_tokens_neox': 599, 'n_words': 155}