<commit_before>#ifndef FL_DATASET_H
#define FL_DATASET_H


#include <cstddef>
#include <my/commons.h>
#include <stdexcept>
#include <vector>


namespace fl {

template <typename ValueT>
class DataSetEntry
{
	private: typedef std::vector<ValueT> Container;

	FL_MAKE_ITERATORS(public, Container, Input, input, in_) 
	FL_MAKE_ITERATORS(public, Container, Output, output, out_) 


	public: template <typename InIterT, typename OutIterT>
			DataSetEntry(InIterT inFirst, InIterT inLast,
						 OutIterT outFirst, OutIterT outLast)
	: in_(inFirst, inLast),
	  out_(outFirst, outLast)
	{
	}

	public: std::size_t numOfInputs() const
	{
		return in_.size();
	}

	public: std::size_t numOfOutputs() const
	{
		return out_.size();
	}


	private: Container in_;
	private: Container out_;
}; // DataSetEntry


template <typename ValueT>
class DataSet
{
	private: typedef std::vector< DataSetEntry<ValueT> > EntryContainer;

	FL_MAKE_ITERATORS(public, EntryContainer, Entry, entry, entries_) 
	//FL_MAKE_STL_ITERATORS(public, EntryContainer, entries_) 


	public: DataSet(std::size_t ni, std::size_t no)
	: ni_(ni),
	  no_(no)
	{
	}

	public: void add(const DataSetEntry<ValueT>& entry)
	{
		if (entry.numOfInputs() != ni_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
		}
		if (entry.numOfOutputs() != no_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
		}

		entries_.push_back(entry);
	}

	public: EntryIterator insert(EntryIterator pos, const DataSetEntry<ValueT>& entry)
	{
		if (entry.numOfInputs() != ni_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
		}
		if (entry.numOfOutputs() != no_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
		}

		return entries_.insert(pos, entry);
	}

	public: EntryIterator insert(ConstEntryIterator pos, const DataSetEntry<ValueT>& entry)
	{
		if (entry.numOfInputs() != ni_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
		}
		if (entry.numOfOutputs() != no_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
		}

		return entries_.insert(pos, entry);
	}

//	public: EntryIterator insert(ConstEntryIterator pos, const DataSetEntry<ValueT>& entry)
//	{
//		if (entry.numOfInputs() != ni_)
//		{
//			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
//		}
//		if (entry.numOfOutputs() != no_)
//		{
//			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
//		}
//
//		return entries_.insert(pos, entry);
//	}

	public: EntryIterator erase(EntryIterator pos)
	{
		return entries_.erase(pos);
	}

	public: EntryIterator erase(ConstEntryIterator pos)
	{
		return entries_.erase(pos);
	}

	public: std::size_t size() const
	{
		return entries_.size();
	}


	private: std::size_t ni_; ///< Number of inputs in each entry
	private: std::size_t no_; ///< Number of outputs in each entry
	private: EntryContainer entries_;
};

} // Namespace fl

#endif // FL_DATASET_H<commit_msg>Added new methods to DataSet and DataSetEntry classes: getField, numOfInputs, numOfOutputs<commit_after>#ifndef FL_DATASET_H
#define FL_DATASET_H


#include <cstddef>
#include <my/commons.h>
#include <stdexcept>
#include <vector>


namespace fl {

template <typename ValueT>
class DataSetEntry
{
	private: typedef std::vector<ValueT> Container;

	FL_MAKE_ITERATORS(public, Container, Input, input, in_) 
	FL_MAKE_ITERATORS(public, Container, Output, output, out_) 


	public: template <typename InIterT, typename OutIterT>
			DataSetEntry(InIterT inFirst, InIterT inLast,
						 OutIterT outFirst, OutIterT outLast)
	: in_(inFirst, inLast),
	  out_(outFirst, outLast)
	{
	}

	public: std::size_t numOfInputs() const
	{
		return in_.size();
	}

	public: std::size_t numOfOutputs() const
	{
		return out_.size();
	}

	public: ValueT getField(std::size_t index) const
	{
		if (index >= (in_.size()+out_.size()))
		{
			FL_THROW2(std::invalid_argument, "Index is out-of-range");
		}

		return index < in_.size() ? in_.at(index)
								  : out_.at(index-in_.size());
	}


	private: Container in_;
	private: Container out_;
}; // DataSetEntry


template <typename ValueT>
class DataSet
{
	private: typedef std::vector< DataSetEntry<ValueT> > EntryContainer;

	FL_MAKE_ITERATORS(public, EntryContainer, Entry, entry, entries_) 
	//FL_MAKE_STL_ITERATORS(public, EntryContainer, entries_) 


	public: DataSet(std::size_t ni, std::size_t no)
	: ni_(ni),
	  no_(no)
	{
	}

	public: void add(const DataSetEntry<ValueT>& entry)
	{
		if (entry.numOfInputs() != ni_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
		}
		if (entry.numOfOutputs() != no_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
		}

		entries_.push_back(entry);
	}

	public: EntryIterator insert(EntryIterator pos, const DataSetEntry<ValueT>& entry)
	{
		if (entry.numOfInputs() != ni_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
		}
		if (entry.numOfOutputs() != no_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
		}

		return entries_.insert(pos, entry);
	}

	public: EntryIterator insert(ConstEntryIterator pos, const DataSetEntry<ValueT>& entry)
	{
		if (entry.numOfInputs() != ni_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
		}
		if (entry.numOfOutputs() != no_)
		{
			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
		}

		return entries_.insert(pos, entry);
	}

//	public: EntryIterator insert(ConstEntryIterator pos, const DataSetEntry<ValueT>& entry)
//	{
//		if (entry.numOfInputs() != ni_)
//		{
//			FL_THROW2(std::invalid_argument, "Unexpected number of inputs in the entry");
//		}
//		if (entry.numOfOutputs() != no_)
//		{
//			FL_THROW2(std::invalid_argument, "Unexpected number of outputs in the entry");
//		}
//
//		return entries_.insert(pos, entry);
//	}

	public: EntryIterator erase(EntryIterator pos)
	{
		return entries_.erase(pos);
	}

	public: EntryIterator erase(ConstEntryIterator pos)
	{
		return entries_.erase(pos);
	}

	public: std::size_t size() const
	{
		return entries_.size();
	}

	public: std::size_t numOfInputs() const
	{
		return ni_;
	}

	public: std::size_t numOfOutputs() const
	{
		return no_;
	}


	private: std::size_t ni_; ///< Number of inputs in each entry
	private: std::size_t no_; ///< Number of outputs in each entry
	private: EntryContainer entries_;
};

} // Namespace fl

#endif // FL_DATASET_H
{'fraction_non_alphanumeric': 0.1307622777945164, 'fraction_numerical': 0.002561012353118409, 'mean_word_length': 4.375708502024292, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 32, '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': '706158', 'n_tokens_mistral': 2477, 'n_tokens_neox': 2310, 'n_words': 562}