<commit_before>#ifndef CHECKER_HPP
#define CHECKER_HPP

#include <set>
#include <map>
#include <string>
#include <sstream>
#include <locale>


namespace elektra {

using namespace kdb;
using namespace std;

class Type
{
public:
	virtual bool check(Key k) = 0;
	virtual ~Type();
};

Type::~Type()
{}

class AnyType : public Type
{
public:
	bool check(Key)
	{
		return true;
	}
};

class EmptyType : public Type
{
public:
	bool check(Key k)
	{
		return k.getString().empty();
	}
};

class StringType : public Type
{
public:
	bool check(Key k)
	{
		return !k.getString().empty();
	}
};

template <typename T>
class TType : public Type
{
public:
	bool check(Key k)
	{
		istringstream i (k.getString());
		i.imbue (locale("C"));
		T n;
		i >> n;
		if (i.fail()) return false;
		if (!i.eof()) return false;
		return true;
	}
};

class FSType : public Type
{
	std::set<std::string> choices;
public:
	FSType()
	{
		choices.insert("auto");
		choices.insert("swap");
		choices.insert("adfs"); choices.insert("affs"); choices.insert("autofs"); choices.insert("cifs"); choices.insert("coda"); choices.insert("coherent"); choices.insert("cramfs"); choices.insert("debugfs"); choices.insert("devpts"); choices.insert("efs");  choices.insert("ext"); choices.insert("ext2"); choices.insert("ext3"),  choices.insert("hfs");  choices.insert("hfsplus");  choices.insert("hpfs"); choices.insert("iso9660"); choices.insert("jfs"); choices.insert("minix"); choices.insert("msdos"); choices.insert("ncpfs"); choices.insert("nfs"); choices.insert("nfs4"); choices.insert("ntfs"); choices.insert("proc"); choices.insert("qnx4"); choices.insert("ramfs"); choices.insert("reiserfs"); choices.insert("romfs"); choices.insert("smbfs"); choices.insert("sysv"); choices.insert("tmpfs"); choices.insert("udf"); choices.insert("ufs"); choices.insert("umsdos"); choices.insert("usbfs"); choices.insert("vfat"); choices.insert("xenix"); choices.insert("xfs"); choices.insert("xiafs");
	}

	bool check(Key k)
	{
		std::string label = k.getString();
		size_t oldpos = 0;
		size_t pos = label.find(',');;
		while (pos != string::npos)
		{
			std::string type = label.substr (oldpos, pos - oldpos);
			if (choices.find(type) == choices.end()) return false;

			oldpos = pos+1;<commit_msg>ext4 added<commit_after>#ifndef CHECKER_HPP
#define CHECKER_HPP

#include <set>
#include <map>
#include <string>
#include <sstream>
#include <locale>


namespace elektra {

using namespace kdb;
using namespace std;

class Type
{
public:
	virtual bool check(Key k) = 0;
	virtual ~Type();
};

Type::~Type()
{}

class AnyType : public Type
{
public:
	bool check(Key)
	{
		return true;
	}
};

class EmptyType : public Type
{
public:
	bool check(Key k)
	{
		return k.getString().empty();
	}
};

class StringType : public Type
{
public:
	bool check(Key k)
	{
		return !k.getString().empty();
	}
};

template <typename T>
class TType : public Type
{
public:
	bool check(Key k)
	{
		istringstream i (k.getString());
		i.imbue (locale("C"));
		T n;
		i >> n;
		if (i.fail()) return false;
		if (!i.eof()) return false;
		return true;
	}
};

class FSType : public Type
{
	std::set<std::string> choices;
public:
	FSType()
	{
		choices.insert("auto");
		choices.insert("swap");
		choices.insert("adfs"); choices.insert("affs"); choices.insert("autofs"); choices.insert("cifs"); choices.insert("coda"); choices.insert("coherent"); choices.insert("cramfs"); choices.insert("debugfs"); choices.insert("devpts"); choices.insert("efs");  choices.insert("ext"); choices.insert("ext2"); choices.insert("ext3"); choices.insert("ext4"); choices.insert("hfs");  choices.insert("hfsplus");  choices.insert("hpfs"); choices.insert("iso9660"); choices.insert("jfs"); choices.insert("minix"); choices.insert("msdos"); choices.insert("ncpfs"); choices.insert("nfs"); choices.insert("nfs4"); choices.insert("ntfs"); choices.insert("proc"); choices.insert("qnx4"); choices.insert("ramfs"); choices.insert("reiserfs"); choices.insert("romfs"); choices.insert("smbfs"); choices.insert("sysv"); choices.insert("tmpfs"); choices.insert("udf"); choices.insert("ufs"); choices.insert("umsdos"); choices.insert("usbfs"); choices.insert("vfat"); choices.insert("xenix"); choices.insert("xfs"); choices.insert("xiafs");
	}

	bool check(Key k)
	{
		std::string label = k.getString();
		size_t oldpos = 0;
		size_t pos = label.find(',');;
		while (pos != string::npos)
		{
			std::string type = label.substr (oldpos, pos - oldpos);
			if (choices.find(type) == choices.end()) return false;

			oldpos = pos+1;
{'fraction_non_alphanumeric': 0.1983178397521027, 'fraction_numerical': 0.005312084993359893, 'mean_word_length': 5.483500717360115, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, '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': '6860420', 'n_tokens_mistral': 1629, 'n_tokens_neox': 1558, 'n_words': 341}