Fix attribute name extraction in ArffFiles

This commit is contained in:
2023-07-06 16:57:25 +02:00
parent a7098a907e
commit 3bae1fe390
2 changed files with 4 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ void ArffFiles::load(const string& fileName, bool classLast)
type = "";
while (ss >> type_w)
type += type_w + " ";
attributes.emplace_back(attribute, trim(type));
attributes.emplace_back(trim(attribute), trim(type));
continue;
}
if (line[0] == '@') {
@@ -111,8 +111,8 @@ void ArffFiles::generateDataset(bool classLast)
string ArffFiles::trim(const string& source)
{
string s(source);
s.erase(0, s.find_first_not_of(" \n\r\t"));
s.erase(s.find_last_not_of(" \n\r\t") + 1);
s.erase(0, s.find_first_not_of(" '\n\r\t"));
s.erase(s.find_last_not_of(" '\n\r\t") + 1);
return s;
}