<commit_before>﻿using ChessDotNet;
using ChessDotNet.Variants.Crazyhouse;
using System.Collections.Generic;

namespace ChessVariantsTraining.Extensions
{
    public static class ChessGameExtensions
    {
        public static Dictionary<string, int> GenerateJsonPocket(this ChessGame game)
        {
            CrazyhouseChessGame zhCurrent = game as CrazyhouseChessGame;
            if (zhCurrent == null)
            {
                return null;
            }

            Dictionary<string, int> pocket = new Dictionary<string, int>();
            foreach (Piece p in zhCurrent.WhitePocket)
            {
                string key = "white-" + p.GetType().Name.ToLowerInvariant();
                if (!pocket.ContainsKey(key))
                {
                    pocket.Add(key, 1);
                }
                else
                {
                    pocket[key]++;
                }
            }

            foreach (Piece p in zhCurrent.BlackPocket)
            {
                string key = "black-" + p.GetType().Name.ToLowerInvariant();
                if (!pocket.ContainsKey(key))
                {
                    pocket.Add(key, 1);
                }
                else
                {
                    pocket[key]++;
                }
            }

            return pocket;
        }
    }
}<commit_msg>Rewrite GenerateJsonPocket to complete output<commit_after>﻿using ChessDotNet;
using ChessDotNet.Variants.Crazyhouse;
using System.Collections.Generic;

namespace ChessVariantsTraining.Extensions
{
    public static class ChessGameExtensions
    {
        public static Dictionary<string, int> GenerateJsonPocket(this ChessGame game)
        {
            CrazyhouseChessGame zhCurrent = game as CrazyhouseChessGame;
            if (zhCurrent == null)
            {
                return null;
            }

            Dictionary<string, int> pocket = new Dictionary<string, int>()
            {
                { "white-queen", 0 },
                { "white-rook", 0 },
                { "white-bishop", 0 },
                { "white-knight", 0 },
                { "white-pawn", 0 },
                { "black-queen", 0 },
                { "black-rook", 0 },
                { "black-bishop", 0 },
                { "black-knight", 0 },
                { "black-pawn", 0 }
            };
            foreach (Piece p in zhCurrent.WhitePocket)
            {
                string key = "white-" + p.GetType().Name.ToLowerInvariant();
                pocket[key]++;
            }

            foreach (Piece p in zhCurrent.BlackPocket)
            {
                string key = "black-" + p.GetType().Name.ToLowerInvariant();
                pocket[key]++;
            }

            return pocket;
        }
    }
}
{'fraction_non_alphanumeric': 0.10075839653304441, 'fraction_numerical': 0.004333694474539545, 'mean_word_length': 1.287365813377374, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3137594', 'n_tokens_mistral': 768, 'n_tokens_neox': 704, 'n_words': 148}