<commit_before>#include <sstream>
#include <string>
#include <tuple>
#include <optional>
#include <functional>

#include "iterate_tuple.h"
#include "dataconsts.h"
#include "entity_system.h"
#include "chat/whisper_chat.h"

namespace {
template <typename... Args>
class Parser {
    public:
        Parser(std::stringstream&& ss) {
            size_t index = 0;
            Core::for_each(args, [&ss, &index, this](auto& data) {
                is_arg_ok[index++] = parse(ss, data);
            });
        }

        bool is_good() const {
            return std::all_of(is_arg_ok.cbegin(), is_arg_ok.cend(), [](bool i) {
                return i;
            });
        }
        
        template <size_t N>
        decltype(auto) get_arg() {
            return std::get<N>(args);
        }

    private:
        std::array<bool, sizeof...(Args)> is_arg_ok;
        std::tuple<Args...> args;

        template <typename T>
        static bool parse(std::stringstream& ss, T& h) {
            return static_cast<bool>(ss >> h);
        }

        template <typename T>
        static bool parse(std::stringstream& ss, std::optional<T>& h) {
            T tmp;
            const bool has_data = ss >> tmp;
            if (has_data) {
                h = tmp;
            }
            return true;
        }
};<commit_msg>Update gm_commands.cpp<commit_after>#include <sstream>
#include <string>
#include <tuple>
#include <optional>
#include <functional>

#include "iterate_tuple.h"
#include "dataconsts.h"
#include "entity_system.h"
#include "chat/whisper_chat.h"

namespace {
template <typename... Args>
class Parser {
    public:
        Parser(std::stringstream&& ss) {
            size_t index = 0;
            Core::for_each(args, [&ss, &index, this](auto& data) {
                is_arg_ok[index++] = parse(ss, data);
            });
        }

        bool is_good() const {
            return std::all_of(is_arg_ok.cbegin(), is_arg_ok.cend(), [](bool i) {
                return i;
            });
        }
        
        bool is_arg_good(size_t index) const {
            return is_arg_ok[index];
        }
        
        template <size_t N>
        decltype(auto) get_arg() {
            return std::get<N>(args);
        }

    private:
        std::array<bool, sizeof...(Args)> is_arg_ok;
        std::tuple<Args...> args;

        template <typename T>
        static bool parse(std::stringstream& ss, T& h) {
            return static_cast<bool>(ss >> h);
        }

        template <typename T>
        static bool parse(std::stringstream& ss, std::optional<T>& h) {
            T tmp;
            const bool has_data = ss >> tmp;
            if (has_data) {
                h = tmp;
            }
            return true;
        }
};
{'fraction_non_alphanumeric': 0.137155297532656, 'fraction_numerical': 0.000725689404934688, 'mean_word_length': 1.790485829959514, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 39, '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': '7029932', 'n_tokens_mistral': 881, 'n_tokens_neox': 860, 'n_words': 197}