feat: read data from arff files #1
@ -81,6 +81,31 @@ namespace ARFF {
|
||||
TestIntegrity();
|
||||
}
|
||||
|
||||
void Arff::Print(void) {
|
||||
std::cout << attributeList.size() << " attributes\n";
|
||||
std::cout << database.size() << " examples\n";
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "Attribute (#): values\n";
|
||||
for (AttributeType type : attributeList) {
|
||||
std::cout << type.attribute << " (" << type.values.size() << "):";
|
||||
for (std::string value : type.values) {
|
||||
std::cout << " " << value;
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << relation << '\n';
|
||||
for (Instance instance: database) {
|
||||
for (std::string value : instance.values) {
|
||||
std::cout << '\t' << value;
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Add the attribute to the list
|
||||
void Arff::AddAttribute(std::string line) {
|
||||
std::stringstream parser(line);
|
||||
|
@ -29,6 +29,7 @@ namespace ARFF {
|
||||
public:
|
||||
Arff() = default;
|
||||
void Read(std::string filename);
|
||||
void Print(void);
|
||||
private:
|
||||
std::string relation;
|
||||
std::vector<AttributeType> attributeList;
|
||||
|
@ -9,4 +9,5 @@ int main(int argc, char* argv[]) {
|
||||
ARFF::ParseArguments(argc, argv);
|
||||
ARFF::Arff data;
|
||||
data.Read(ARFF::GetDataFilename());
|
||||
data.Print();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user